示例#1
0
文件: fexport.py 项目: EHRI/rspub-gui
    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)
示例#2
0
文件: fexport.py 项目: EHRI/rspub-gui
 def __init__(self, export_mode, all_resources=False):
     WorkWidget.__init__(self, work=export_mode + " " + "Transport", title_style=Style.transport_title())
     self.chk_trial_run.setVisible(False)
     self.export_mode = export_mode
     self.all_resources = all_resources
     _("Transport")