Ejemplo n.º 1
0
    def __init__(self, parent):
        QWidget.__init__(self)
        self.ctrl = QApplication.instance().ctrl
        self.parent = parent
        self.setWindowTitle("About")
        hbox = QHBoxLayout()
        pic = QLabel(self)
        pix = QPixmap(
            os.path.join(self.ctrl.application_home, 'conf/img/logo_h.png'))
        pic.setPixmap(pix)
        hbox.addWidget(pic)

        vbox = QVBoxLayout()

        lbl_title = QLabel("Metadata Publishing Tool", self)
        lbl_title.setMinimumWidth(400)
        font = QFont()
        font.setPointSize(20)
        font.setBold(True)
        lbl_title.setFont(font)
        lbl_title.setContentsMargins(2, 5, 5, 7)
        lbl_title.setStyleSheet(Style.h2())
        vbox.addWidget(lbl_title)
        #vbox.addSpacing(20)
        vbox.addStretch(1)

        grid = QGridLayout()
        grid.setContentsMargins(0, 0, 0, 0)  # left, top, right, bottom
        grid.setVerticalSpacing(2)
        grid.setHorizontalSpacing(2)

        grid.addWidget(QLabel("Version: "), 1, 1)
        grid.addWidget(QLabel(version.__version__), 1, 2)

        grid.addWidget(QLabel("Release: "), 2, 1)
        grid.addWidget(QLabel(version.__release_date__), 2, 2)

        hbox_grid = QHBoxLayout()
        hbox_grid.addLayout(grid)
        hbox_grid.addStretch(1)
        vbox.addLayout(hbox_grid)

        vbox.addSpacing(10)
        txt = QTextBrowser()
        txt.setMinimumHeight(250)
        txt.setOpenExternalLinks(True)
        txt.setOpenLinks(False)
        txt.anchorClicked.connect(self.on_anchor_clicked)
        txt.append(version.__about__)
        vbox.addWidget(txt)

        hbox.addLayout(vbox)
        hbox.addStretch(1)
        self.setLayout(hbox)
        self.move(200, 200)
        self.setWindowFlags((self.windowFlags() | Qt.CustomizeWindowHint)
                            & ~Qt.WindowMaximizeButtonHint
                            & ~Qt.WindowMinimizeButtonHint)
        self.show()
Ejemplo n.º 2
0
    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)
Ejemplo n.º 3
0
 def __init__(self, work="", title_style=Style.h2()):
     QWidget.__init__(self)
     self.ctrl = QApplication.instance().ctrl
     self.ctrl.switch_language.connect(self.on_switch_language)
     self.ctrl.switch_configuration.connect(self.on_switch_configuration)
     self.paras = self.ctrl.paras
     self.conf = GuiConf()
     # work should be a verb: Execute, Transport ...
     self.work = work
     self.title_style = title_style
     self.setWindowTitle(_(self.work))
     self.executor_thread = None
     self.splitter_event_moved = False
     self.splitter_title_moved = False
     self.init_ui()
     self.show()
Ejemplo n.º 4
0
    def init_ui(self):
        vbl_0 = QVBoxLayout(self)

        grid = QGridLayout()
        grid.setContentsMargins(0, 0, 0, 0)  # left, top, right, bottom
        grid.setVerticalSpacing(5)

        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)

        str_conv = (self.str2tx, self.tx2str)
        int_conv = (self.int2tx, self.tx2int)

        self.para_widgets = {
            "resource_dir": ParaLine(self, "resource_dir", str_conv, grid, 3, True),
            "metadata_dir": ParaLine(self, "metadata_dir", str_conv, grid, 5, False),
            "description_dir": ParaLine(self, "description_dir", str_conv, grid, 7, True),
            "plugin_dir": ParaLine(self, "plugin_dir", str_conv, grid, 9, True),
            "url_prefix": ParaLine(self, "url_prefix", str_conv, grid, 11, False),
            "strategy": ParaStrategyDrop(self, "strategy", grid, 13),
            "max_items_in_list": ParaLine(self, "max_items_in_list", int_conv, grid, 15, False, 100),
            "zero_fill_filename": ParaLine(self, "zero_fill_filename", int_conv, grid, 17, False, 100),
            "is_saving_pretty_xml": ParaCheck(self, "is_saving_pretty_xml", grid, 19),
            "is_saving_sitemaps": ParaCheck(self, "is_saving_sitemaps", grid, 20),
            "has_wellknown_at_root": ParaCheck(self, "has_wellknown_at_root", grid, 21)
        }

        self.button_reset = QPushButton(_("Reset"), self)
        self.button_reset.clicked.connect(self.on_button_reset_clicked)
        grid.addWidget(self.button_reset, 22, 3)

        vbl_0.addLayout(grid)
        vbl_0.addStretch(1)
        self.setLayout(vbl_0)
Ejemplo n.º 5
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.configure_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)
        vbl_0.insertSpacing(2, 25)

        grid = QGridLayout()
        grid.setContentsMargins(0, 0, 0, 0)  # left, top, right, bottom
        grid.setVerticalSpacing(5)

        self.para_widgets = {
            "resource_dir":
            ParaLine(self, "resource_dir", ParaWidget.str_conv(), grid, 3,
                     True),
            "metadata_dir":
            ParaLine(self, "metadata_dir", ParaWidget.str_conv(), grid, 5,
                     False),
            "description_dir":
            ParaLine(self, "description_dir", ParaWidget.str_conv(), grid, 7,
                     True),
            "plugin_dir":
            ParaLine(self, "plugin_dir", ParaWidget.str_conv(), grid, 9, True),
            "url_prefix":
            ParaLine(self, "url_prefix", ParaWidget.str_conv(), grid, 11,
                     False),
            "strategy":
            ParaStrategyDrop(self, "strategy", grid, 15),
            "max_items_in_list":
            ParaLine(self,
                     "max_items_in_list",
                     ParaWidget.int_conv(),
                     grid,
                     17,
                     False,
                     width=100),
            "zero_fill_filename":
            ParaLine(self,
                     "zero_fill_filename",
                     ParaWidget.int_conv(),
                     grid,
                     19,
                     False,
                     width=100),
            "is_saving_pretty_xml":
            ParaCheck(self, "is_saving_pretty_xml", grid, 21),
            "is_saving_sitemaps":
            ParaCheck(self, "is_saving_sitemaps", grid, 22),
            "has_wellknown_at_root":
            ParaCheck(self, "has_wellknown_at_root", grid, 23)
        }

        self.button_reset = QPushButton(_("Reset"), self)
        self.button_reset.clicked.connect(self.on_button_reset_clicked)
        grid.addWidget(self.button_reset, 24, 3)

        vbl_0.addLayout(grid)
        vbl_0.addStretch(1)
        self.setLayout(vbl_0)
Ejemplo n.º 6
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)
Ejemplo n.º 7
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.import_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)
        vbl_0.insertSpacing(2, 25)

        # # scp group
        grid1 = QGridLayout()
        grid1.setContentsMargins(0, 0, 0, 0)  # left, top, right, bottom
        grid1.setVerticalSpacing(5)
        grid1.setHorizontalSpacing(10)

        self.grp_scp = QGroupBox(
            _("Import files with Secure Copy Protocol (scp)"))
        vbox1 = QVBoxLayout()

        self.para_scp_widgets = {
            "imp_scp_server":
            ParaLine(self, "imp_scp_server", ParaWidget.str_conv(), grid1, 3,
                     False),
            "imp_scp_port":
            ParaLine(self,
                     "imp_scp_port",
                     ParaWidget.int_conv(),
                     grid1,
                     5,
                     False,
                     width=100),
            "imp_scp_user":
            ParaLine(self, "imp_scp_user", ParaWidget.str_conv(), grid1, 7,
                     False),
            "imp_scp_remote_path":
            ParaLine(self, "imp_scp_remote_path", ParaWidget.str_conv(), grid1,
                     9, False),
            "imp_scp_local_path":
            ParaLine(self, "imp_scp_local_path", ParaWidget.str_conv(), grid1,
                     11, True),
        }

        self.grp_scp.setLayout(vbox1)
        vbox1.addLayout(grid1)

        hbox_scp = QHBoxLayout()
        hbox_scp.addStretch(1)
        self.scp_button_start = QPushButton(_("Start"))
        self.scp_button_start.clicked.connect(self.on_scp_button_start_clicked)
        hbox_scp.addWidget(self.scp_button_start)
        vbox1.addLayout(hbox_scp)

        vbl_0.addWidget(self.grp_scp)

        vbl_0.addStretch(1)
        self.setLayout(vbl_0)
Ejemplo n.º 8
0
    def init_ui(self):
        vbl_0 = QVBoxLayout(self)

        self.label_title = QLabel(_("Select resources"), 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.select_title())
        hbox = QHBoxLayout()
        hbox.addWidget(lbl_color)
        hbox.addWidget(self.label_title, 1)
        self.btn_help = QPushButton(_("Help..."), self)
        self.btn_help.clicked.connect(self.on_button_help_clicked)
        hbox.addWidget(self.btn_help)
        hbox.setContentsMargins(0, 0, 0, 5)  # left, top, right, bottom
        vbl_0.addLayout(hbox)

        self.grp_simple = QGroupBox(_("Simpel selection: One directory"))
        self.grp_simple.setCheckable(True)
        self.grp_simple.toggled.connect(self.on_grp_simple_toggle)

        # simple group
        self.lbl_simple = QLabel(_("Location"))
        self.edt_simple = QLineEdit()
        self.edt_simple.editingFinished.connect(self.on_edt_simple_finished)
        vbox_simple = QVBoxLayout()
        vbox_simple.setSpacing(0)
        self.btn_simple_brws = QPushButton(_("Browse"))
        self.btn_simple_brws.clicked.connect(self.on_btn_simple_brws_clicked)
        vbox_simple.addWidget(self.btn_simple_brws)
        self.btn_simple_play = QPushButton(_("Play..."))
        self.btn_simple_play.clicked.connect(self.on_btn_simple_play_clicked)
        vbox_simple.addWidget(self.btn_simple_play)

        hbox2 = QHBoxLayout()
        hbox2.addWidget(self.lbl_simple)
        hbox2.addWidget(self.edt_simple)
        hbox2.addLayout(vbox_simple)
        self.grp_simple.setLayout(hbox2)
        vbl_0.addWidget(self.grp_simple)

        self.grp_selector = QGroupBox(_("Advanced: Create a selector"))
        self.grp_selector.setCheckable(True)
        self.grp_selector.toggled.connect(self.on_grp_selector_toggle)
        grid = QGridLayout()

        # selector group: selector file
        self.lbl_saved_as = QLabel(_("Selector"))
        self.lbl_selector_file = QLabel()
        self.lbl_selector_file.setTextInteractionFlags(
            Qt.TextSelectableByMouse)
        grid.addWidget(self.lbl_saved_as, 1, 1)
        grid.addWidget(self.lbl_selector_file, 1, 2, 1, 2)

        # selector group: includes
        self.lbl_includes = QLabel(_("Includes"))
        self.lbl_includes.setAlignment(Qt.AlignTop)
        self.txt_includes = QPlainTextEdit()
        self.txt_includes.installEventFilter(self)
        self.btn_incl_directory = QPushButton(_("Add directory"))
        self.btn_incl_directory.clicked.connect(
            self.on_btn_incl_directory_clicked)
        self.btn_incl_files = QPushButton(_("Add files"))
        self.btn_incl_files.clicked.connect(self.on_btn_incl_files_clicked)
        self.btn_incl_import = QPushButton(_("Import entries"))
        self.btn_incl_import.clicked.connect(self.on_btn_incl_import_clicked)
        grid.addWidget(self.lbl_includes, 2, 1)
        grid.addWidget(self.txt_includes, 2, 2)
        vbox_inc = QVBoxLayout()
        vbox_inc.setSpacing(0)
        vbox_inc.addWidget(self.btn_incl_directory)
        vbox_inc.addWidget(self.btn_incl_files)
        vbox_inc.addWidget(self.btn_incl_import)
        vbox_inc.addStretch(1)
        grid.addLayout(vbox_inc, 2, 3)

        # selector group: excludes
        self.lbl_excludes = QLabel(_("Excludes"))
        self.lbl_excludes.setAlignment(Qt.AlignTop)
        self.txt_excludes = QPlainTextEdit()
        self.txt_excludes.installEventFilter(self)
        self.btn_excl_directory = QPushButton(_("Add directory"))
        self.btn_excl_directory.clicked.connect(
            self.on_btn_excl_directory_clicked)
        self.btn_excl_files = QPushButton(_("Add files"))
        self.btn_excl_files.clicked.connect(self.on_btn_excl_files_clicked)
        self.btn_excl_import = QPushButton(_("Import entries"))
        self.btn_excl_import.clicked.connect(self.on_btn_excl_import_clicked)
        grid.addWidget(self.lbl_excludes, 3, 1)
        grid.addWidget(self.txt_excludes, 3, 2)
        vbox_exc = QVBoxLayout()
        vbox_exc.setSpacing(0)
        vbox_exc.addWidget(self.btn_excl_directory)
        vbox_exc.addWidget(self.btn_excl_files)
        vbox_exc.addWidget(self.btn_excl_import)
        vbox_exc.addStretch(1)
        grid.addLayout(vbox_exc, 3, 3)

        # selector group: bottom buttons
        self.btn_open_selector = QPushButton(_("Open..."))
        self.btn_open_selector.clicked.connect(
            self.on_btn_open_selector_clicked)
        self.btn_save_selector_as = QPushButton(_("Save as..."))
        self.btn_save_selector_as.clicked.connect(
            self.on_btn_save_selector_as_clicked)
        self.btn_play_selected = QPushButton(_("Play..."))
        self.btn_play_selected.clicked.connect(
            self.on_btn_play_selected_clicked)
        hbox3 = QHBoxLayout()
        hbox3.addStretch(1)
        hbox3.addWidget(self.btn_open_selector)
        hbox3.addWidget(self.btn_save_selector_as)
        grid.addLayout(hbox3, 4, 1, 1, 2)
        grid.addWidget(self.btn_play_selected, 4, 3)

        self.grp_selector.setLayout(grid)
        vbl_0.addWidget(self.grp_selector)

        self.setLayout(vbl_0)