8000 AdvancedPopup: initializer and UI layout · larray-project/larray-editor@77e8a39 · GitHub
[go: up one dir, main page]

Skip to content

Commit 77e8a39

Browse files
committed
AdvancedPopup: initializer and UI layout
1 parent 706e81b commit 77e8a39

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

larray_editor/editor.py

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,11 +400,86 @@ def showAdvancedPopup(self):
400400
popup.finished.connect(self.closeDialog)
401401
popup.exec_()
402402

403+
403404
def closeDialog(self):
404405
self.close()
405406

406407

407408

409+
class AdvancedPopup(QDialog):
410+
def __init__(self, parent=None):
411+
# Self-commentary: an additional/extra parent argument with default value None is added.
412+
# This subtletly relates to following line of code elsewhere:
413+
# >> popup = AdvancedPopup(self)
414+
# The explicit 'self' argument here corresponds to the second 'parent' of AdvancedPopup (not the implicit first 'self' to be used inside the class)
415+
# Put differently, the 'self' written in the expression 'AdvancedPopup(self)' is *at the location of that expression* actually referring to EurostatBrowserDialog
416+
417+
# Pass the parent to the base class constructor
418+
super().__init__(parent)
419+
420+
# Inititalize the UI and set default values
421+
self.initUI()
422+
self.yaml_content = {}
423+
424+
425+
def initUI(self):
426+
self.resize(600, 600)
427+
layout = QVBoxLayout(self)
428+
429+
# Button to load YAML
430+
self.loadButton = QPushButton("Load YAML", self)
431+
self.loadButton.clicked.connect(self.loadYAML)
432+
layout.addWidget(self.loadButton)
433+
434+
# TextEdit for YAML content
435+
self.yamlTextEdit = QTextEdit(self)
436+
437+
import textwrap
438+
default_yaml = textwrap.dedent("""\
439+
# First indicator with its specific settings.
440+
indicator_name_1:
441+
name: var1, var2, var3
442+
var1:
443+
label1: renamed_label1
444+
label2: renamed_label2
445+
var2:
446+
label1: renamed_label1
447+
label2: renamed_label2
448+
...
449+
# You can continue adding more indicators and labels as per your requirements.
450+
""")
451+
452+
# Set default YAML content (example)
453+
self.yamlTextEdit.setPlainText(default_yaml)
454+
layout.addWidget(self.yamlTextEdit)
455+
456+
# Checkbox for generating a copy
457+
self.generateCopyCheckBox = QCheckBox("Generate additional copy", self)
458+
layout.addWidget(self.generateCopyCheckBox)
459+
460+
# Horizontal layout for dropdown and path selection
461+
copyLayout = QHBoxLayout()
462+
463+
# ComboBox (Drop-down) for file formats
464+
self.fileFormatComboBox = QComboBox(self)
465+
self.fileFormatComboBox.addItems(["xlsx", "IODE", "csv"])
466+
copyLayout.addWidget(self.fileFormatComboBox)
467+
468+
# Button for path selection
469+
self.pathSelectionButton = QPushButton("Select Path...", self)
470+
self.pathSelectionButton.clicked.connect(self.selectPath)
471+
copyLayout.addWidget(self.pathSelectionButton)
472+
layout.addLayout(copyLayout)
473+
474+
# Final button to proceed with the main task and optionally generate a copy
475+
self.proceedButton = QPushButton("Proceed", self)
476+
self.proceedButton.clicked.connect(self.proceedWithTasks)
477+
layout.addWidget(self.proceedButton)
478+
479+
480+
481+
482+
408483
class AbstractEditor(QMainWindow):
409484
"""Abstract Editor Window"""
410485

0 commit comments

Comments
 (0)
0