def init_ui(self): vbl_0 = QVBoxLayout(self) grid = QGridLayout() grid.setContentsMargins(0, 0, 0, 0) # left, top, right, bottom grid.setVerticalSpacing(2) grid.setHorizontalSpacing(2) self.label_title = QLabel(self) font = QFont() font.setPointSize(18) font.setBold(True) self.label_title.setFont(font) self.label_title.setContentsMargins(2, 5, 5, 7) self.label_title.setStyleSheet(Style.h2()) hbox = QHBoxLayout() hbox.addWidget(self.label_title, 1) hbox.setContentsMargins(0, 0, 0, 5) grid.addLayout(hbox, 1, 1, 1, 3) # ordinal = 3 self.widgets = [] for tup in self.paras.describe(): para_name = QLabel(self) para_value = QLabel(self) para_name.setContentsMargins(5, 1, 5, 1) para_value.setContentsMargins(5, 1, 5, 1) para_name.setTextInteractionFlags(Qt.TextSelectableByMouse) para_value.setTextInteractionFlags(Qt.TextSelectableByMouse) # special colors for parameters and derived values if tup[0]: para_name.setStyleSheet(Style.parameter()) para_value.setStyleSheet(Style.parameter()) else: para_name.setStyleSheet(Style.derived()) para_value.setStyleSheet(Style.derived()) # Make urls clickable if isinstance(tup[2], str) and tup[2].startswith("http"): para_value.linkActivated.connect(self.on_link_activated) self.widgets.append([para_name, para_value]) grid.addWidget(para_name, ordinal, 1) grid.addWidget(para_value, ordinal, 2) ordinal += 1 # hbox = QHBoxLayout() hbox.addLayout(grid) vbox = QVBoxLayout() vbox.addStretch(1) self.btn_run = QPushButton(_("Run...")) self.btn_run.clicked.connect(self.on_btn_run_clicked) vbox.addWidget(self.btn_run) hbox.addLayout(vbox) hbox.addStretch(1) vbl_0.addLayout(hbox) vbl_0.addStretch(1) self.setLayout(vbl_0)
def init_ui(self): vbl_0 = QVBoxLayout(self) self.label_title = QLabel(self) font = QFont() font.setPointSize(18) font.setBold(True) self.label_title.setFont(font) self.label_title.setContentsMargins(2, 5, 5, 7) self.label_title.setStyleSheet(Style.h2()) lbl_color = QLabel(" ", self) lbl_color.setStyleSheet(Style.transport_title()) hbox1 = QHBoxLayout() hbox1.addWidget(lbl_color) hbox1.addWidget(self.label_title, 1) self.btn_help = QPushButton(_("Help..."), self) self.btn_help.clicked.connect(self.on_button_help_clicked) hbox1.addWidget(self.btn_help) hbox1.setContentsMargins(0, 0, 0, 5) vbl_0.addLayout(hbox1) grid1 = QGridLayout() grid1.setContentsMargins(0, 0, 0, 0) # left, top, right, bottom grid1.setVerticalSpacing(2) grid1.setHorizontalSpacing(2) self.lbl_metadata_key = SelectableLabel(self) self.lbl_metadata_value = SelectableLabel(self) grid1.addWidget(self.lbl_metadata_key, 2, 1) grid1.addWidget(self.lbl_metadata_value, 2, 2) self.lbl_last_execution_key = SelectableLabel(self) self.lbl_last_execution_value = SelectableLabel(self) grid1.addWidget(self.lbl_last_execution_key, 3, 1) grid1.addWidget(self.lbl_last_execution_value, 3, 2) hbox2 = QHBoxLayout() hbox2.addLayout(grid1) hbox2.addStretch(1) vbl_0.addLayout(hbox2) vbl_0.insertSpacing(2, 25) # # scp group grid2 = QGridLayout() grid2.setContentsMargins(0, 0, 0, 0) # left, top, right, bottom grid2.setVerticalSpacing(5) grid2.setHorizontalSpacing(10) self.grp_scp = QGroupBox(_("Transfer files with Secure Copy Protocol (scp)")) vbox3 = QVBoxLayout() self.para_scp_widgets = { "exp_scp_server": ParaLine(self, "exp_scp_server", ParaWidget.str_conv(), grid2, 3, False), "exp_scp_port": ParaLine(self, "exp_scp_port", ParaWidget.int_conv(), grid2, 5, False, width=100), "exp_scp_user": ParaLine(self, "exp_scp_user", ParaWidget.str_conv(), grid2, 7, False), "exp_scp_document_root": ParaLine(self, "exp_scp_document_root", ParaWidget.str_conv(), grid2, 9, False), } self.lbl_server_path = QLabel(_("server_path_label")) self.edt_server_path = QLabel(self.ctrl.paras.server_path()) self.edt_server_path.setStyleSheet(Style.derived()) self.edt_server_path.setTextInteractionFlags(Qt.TextSelectableByMouse) grid2.addWidget(self.lbl_server_path, 11, 1) grid2.addWidget(self.edt_server_path, 11, 2) self.grp_scp.setLayout(vbox3) vbox3.addLayout(grid2) hbox_scp = QHBoxLayout() hbox_scp.addStretch(1) self.scp_radio_all = QRadioButton(_("Export all resources")) self.scp_radio_all.setChecked(False) self.scp_radio_latest = QRadioButton(_("Export latest changes")) self.scp_radio_latest.setChecked(True) hbox_scp.addWidget(self.scp_radio_all) hbox_scp.addWidget(self.scp_radio_latest) self.scp_button_start = QPushButton(_("Start transfer")) self.scp_button_start.clicked.connect(self.on_scp_button_start_clicked) hbox_scp.addWidget(self.scp_button_start) vbox3.addLayout(hbox_scp) vbl_0.addWidget(self.grp_scp) vbl_0.insertSpacing(4, 15) # # zip group grid3 = QGridLayout() grid3.setContentsMargins(0, 0, 0, 0) # left, top, right, bottom grid3.setVerticalSpacing(5) grid3.setHorizontalSpacing(10) self.grp_zip = QGroupBox(_("Create a .zip file")) vbox4 = QVBoxLayout() self.para_zip_widgets = { "zip_filename": ParaLine(self, "zip_filename", ParaWidget.str_conv(), grid3, 3, browse="SaveFileName") } self.grp_zip.setLayout(vbox4) vbox4.addLayout(grid3) hbox_zip = QHBoxLayout() hbox_zip.addStretch(1) self.zip_radio_all = QRadioButton(_("Zip all resources")) self.zip_radio_all.setChecked(False) self.zip_radio_latest = QRadioButton(_("Zip latest changes")) self.zip_radio_latest.setChecked(True) hbox_zip.addWidget(self.zip_radio_all) hbox_zip.addWidget(self.zip_radio_latest) self.zip_button_start = QPushButton(_("Start creation")) self.zip_button_start.clicked.connect(self.on_zip_button_start_clicked) hbox_zip.addWidget(self.zip_button_start) vbox4.addLayout(hbox_zip) vbl_0.addWidget(self.grp_zip) vbl_0.addStretch(1) self.setLayout(vbl_0)
def __init__(self, *__args): QLabel.__init__(self, *__args) self.setContentsMargins(5, 1, 5, 1) self.setTextInteractionFlags(Qt.TextSelectableByMouse) self.setStyleSheet(Style.derived())