Example #1
0
    def InitWindow(self):
        self.setWindowIcon(QtGui.QIcon("icon.png"))
        self.setWindowTitle(self.title)
        self.setGeometry(self.left, self.top, self.width, self.height)

        vbox = QVBoxLayout()

        button = QPushButton("Launch")
        button.clicked.connect(self.btn_clicked)

        vbox.addWidget(button)

        self.setLayout(vbox)

        self.wizard = QWizard()
        self.wizard.setWindowTitle("Launcher Page")
        page1 = QWizardPage()
        page1.setTitle("p11111")

        page2 = QWizardPage()
        page2.setTitle("page 2")
        self.wizard.addPage(page1)
        self.wizard.addPage(page2)

        self.show()
Example #2
0
    def InitUi(self):
        self.listwidget = QListWidget()
        # li=['java','c++', 'c#']
        # self.listwidget.insertItem(0,'C++')
        # self.listwidget.insertItem(1,'PYthon')
        # self.listwidget.insertItem(2,'C#')
        self.listwidget.addItems(self.li)
        self.listwidget.setCurrentRow(0)
        self.vbox = QVBoxLayout()
        self.vbox.addWidget(self.listwidget)
        self.vbox2 = QVBoxLayout()
        for text, slot in (("Add", self.add), ("Edit", self.edit),
                           ("Remove", self.remove), ("Sort", self.sort),
                           ("exit", self.exit)):
            btn = QPushButton(text)
            btn.clicked.connect(slot)
            self.vbox2.addWidget(btn)
        groubox = QGroupBox()
        vbox3 = QVBoxLayout()
        wizardbtn = QPushButton("Launch wizard")
        vbox3.addWidget(wizardbtn)
        groubox.setLayout(vbox3)
        wizardbtn.clicked.connect(self.wizartBtnClicked)
        self.vbox2.addWidget(groubox)

        self.hbox = QHBoxLayout()
        self.hbox.addWidget(self.listwidget)
        self.hbox.addLayout(self.vbox2)
        self.setLayout(self.hbox)

        self.wizardwin = QWizard()
Example #3
0
    def InitWindow(self):
        self.setWindowIcon(QtGui.QIcon("transistor.jpg"))
        self.setWindowTitle(self.title)
        self.setGeometry(self.top, self.width, self.height, self.width)

        vbox = QVBoxLayout()
        button = QPushButton("Launch")
        button.clicked.connect(self.btn_clicked)
        vbox.addWidget(button)
        self.setLayout(vbox)
        self.wizard = QWizard()
        self.wizard.setWindowTitle("Launching")
Example #4
0
 def __init__(self):
     # Try and read the labels file
     labels_config = self.getConfigObj(self.name + '.labels')
     try:
         self.labels = labels_config['labels']
     except Exception as err:
         self.labels = None
         logger.error('Could not load the labels file for the  ' +
                      self.name + ' plugin .')
         logger.error(err)
     self.config, self.options_string = self.readConfiguration(
         'string_options')
     self.api = None
     self.wizard = QWizard()
Example #5
0
    def cb_initialize_plugin(self):
        self.wizardwidget = QWizard()
        self.wizardwidget.addPage(self.createIntroPage())
        self.wizardwidget.addPage(sinPage(self.control_api))
        self.wizardwidget.addPage(plotPage(self.control_api))
        self.wizardwidget.addPage(
            connectPage(self.control_api, 'WizardExample'))

        self.pl_set_widget_for_internal_usage(self.wizardwidget)

        self.wizardwidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.wizardwidget.customContextMenuRequested.connect(
            self.show_context_menu)

        return True
    def init_window(self):
        self.setWindowIcon(QtGui.QIcon("home.png"))
        self.setWindowTitle(self.title)
        self.setGeometry(self.left, self.top, self.width, self.height)

        vbox = QVBoxLayout()
        button = QPushButton("Launch")
        button.clicked.connect(self.btn_clicked)

        vbox.addWidget(button)

        self.setLayout(vbox)

        self.wizard = QWizard()
        self.wizard.setWindowTitle("Launching...")

        self.show()
Example #7
0
    def cb_initialize_plugin(self):

        #self.config = config

        # ---------------------------
        # Read configuration
        # ---------------------------
        # Note: this cfg items have to exist!
        # self.show_grid_x = int(self.config['x-grid']['value']) == '1'
        # self.show_grid_y = int(self.config['y-grid']['value']) == '1'
        #
        # int_re = re.compile(r'(\d+)')
        #
        # self.colors_selected = int_re.findall(self.config['color']['value']);
        # self.types_selected = int_re.findall(self.config['style']['value']);

        # --------------------------------
        # Create Widget
        # --------------------------------
        # Create Widget needed for this plugin

        self.wizardwidget = QWizard()
        self.wizardwidget.addPage(self.createIntroPage())
        self.wizardwidget.addPage(sinPage(self.control_api))
        self.wizardwidget.addPage(plotPage(self.control_api))
        self.wizardwidget.addPage(
            connectPage(self.control_api, 'WizardExample'))

        # This call is important, because the background structure needs to know the used widget!
        # In the background the qmidiwindow will becreated and the widget will be added
        self.pl_set_widget_for_internal_usage(self.wizardwidget)

        self.wizardwidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.wizardwidget.customContextMenuRequested.connect(
            self.show_context_menu)

        return True
Example #8
0
    def showDialog(self):
        # Initialise the setup directory empty toavoid exceptions.
        self.setupDictionary = {}

        # ask for a project directory.
        self.projectDirectory = QFileDialog.getExistingDirectory(
            caption=i18n("Where should the comic project go?"),
            options=QFileDialog.ShowDirsOnly)
        if os.path.exists(self.projectDirectory) is False:
            return
        self.pagesDirectory = os.path.relpath(self.projectDirectory,
                                              self.projectDirectory)
        self.exportDirectory = os.path.relpath(self.projectDirectory,
                                               self.projectDirectory)

        wizard = QWizard()
        wizard.setWindowTitle(i18n("Comic Project Setup"))
        wizard.setOption(QWizard.IndependentPages, True)

        # Set up the UI for the wizard
        basicsPage = QWizardPage()
        basicsPage.setTitle(i18n("Basic Comic Project Settings"))
        formLayout = QFormLayout()
        basicsPage.setLayout(formLayout)
        projectLayout = QHBoxLayout()
        self.lnProjectName = QLineEdit()
        basicsPage.registerField("Project Name*", self.lnProjectName)
        self.lnProjectName.setToolTip(
            i18n(
                "A Project name. This can be different from the eventual title"
            ))
        btnRandom = QPushButton()
        btnRandom.setText(i18n("Generate"))
        btnRandom.setToolTip(
            i18n(
                "If you cannot come up with a project name, our highly sophisticated project name generator will serve to give a classy yet down to earth name."
            ))
        btnRandom.clicked.connect(self.slot_generate)
        projectLayout.addWidget(self.lnProjectName)
        projectLayout.addWidget(btnRandom)
        lnConcept = QLineEdit()
        lnConcept.setToolTip(
            i18n(
                "What is your comic about? This is mostly for your own convenience so don't worry about what it says too much."
            ))
        self.cmbLanguage = comics_metadata_dialog.language_combo_box()
        self.cmbLanguage.setToolTip(i18n("The main language the comic is in"))
        self.cmbLanguage.setEntryToCode(
            str(QLocale.system().name()).split("_")[0])
        self.lnProjectDirectory = QLabel(self.projectDirectory)
        self.chkMakeProjectDirectory = QCheckBox(
            i18n("Make a new directory with the project name."))
        self.chkMakeProjectDirectory.setToolTip(
            i18n(
                "This allows you to select a generic comics project directory, in which a new folder will be made for the project using the given project name."
            ))
        self.chkMakeProjectDirectory.setChecked(True)
        self.lnPagesDirectory = QLineEdit()
        self.lnPagesDirectory.setText(i18n("pages"))
        self.lnPagesDirectory.setToolTip(
            i18n(
                "The name for the folder where the pages are contained. If it doesn't exist, it will be created."
            ))
        self.lnExportDirectory = QLineEdit()
        self.lnExportDirectory.setText(i18n("export"))
        self.lnExportDirectory.setToolTip(
            i18n(
                "The name for the folder where the export is put. If it doesn't exist, it will be created."
            ))
        self.lnTemplateLocation = QLineEdit()
        self.lnTemplateLocation.setText(i18n("templates"))
        self.lnTemplateLocation.setToolTip(
            i18n(
                "The name for the folder where the page templates are sought in."
            ))

        self.lnTranslationLocation = QLineEdit()
        self.lnTranslationLocation.setText(i18n("translations"))
        self.lnTranslationLocation.setToolTip(
            "This is the location that POT files will be stored to and PO files will be read from."
        )
        formLayout.addRow(i18n("Comic Concept:"), lnConcept)
        formLayout.addRow(i18n("Project Name:"), projectLayout)
        formLayout.addRow(i18n("Main Language:"), self.cmbLanguage)

        buttonMetaData = QPushButton(i18n("Meta Data"))
        buttonMetaData.clicked.connect(self.slot_edit_meta_data)

        wizard.addPage(basicsPage)

        foldersPage = QWizardPage()
        foldersPage.setTitle(i18n("Folder names and other."))
        folderFormLayout = QFormLayout()
        foldersPage.setLayout(folderFormLayout)
        folderFormLayout.addRow(i18n("Project Directory:"),
                                self.lnProjectDirectory)
        folderFormLayout.addRow("", self.chkMakeProjectDirectory)
        folderFormLayout.addRow(i18n("Pages Directory"), self.lnPagesDirectory)
        folderFormLayout.addRow(i18n("Export Directory"),
                                self.lnExportDirectory)
        folderFormLayout.addRow(i18n("Template Directory"),
                                self.lnTemplateLocation)
        folderFormLayout.addRow(i18n("Translation Directory"),
                                self.lnTranslationLocation)
        folderFormLayout.addRow("", buttonMetaData)
        wizard.addPage(foldersPage)

        # Execute the wizard, and after wards...
        if (wizard.exec_()):

            # First get the directories, check if the directories exist, and otherwise make them.
            self.pagesDirectory = self.lnPagesDirectory.text()
            self.exportDirectory = self.lnExportDirectory.text()
            self.templateLocation = self.lnTemplateLocation.text()
            self.translationLocation = self.lnTranslationLocation.text()
            projectPath = Path(self.projectDirectory)
            # Only make a project directory if the checkbox for that has been checked.
            if self.chkMakeProjectDirectory.isChecked():
                projectPath = projectPath / self.lnProjectName.text()
                if projectPath.exists() is False:
                    projectPath.mkdir()
                self.projectDirectory = str(projectPath)
            if Path(projectPath / self.pagesDirectory).exists() is False:
                Path(projectPath / self.pagesDirectory).mkdir()
            if Path(projectPath / self.exportDirectory).exists() is False:
                Path(projectPath / self.exportDirectory).mkdir()
            if Path(projectPath / self.templateLocation).exists() is False:
                Path(projectPath / self.templateLocation).mkdir()
            if Path(projectPath / self.translationLocation).exists() is False:
                Path(projectPath / self.translationLocation).mkdir()

            # Then store the information into the setup diactionary.
            self.setupDictionary["projectName"] = self.lnProjectName.text()
            self.setupDictionary["concept"] = lnConcept.text()
            self.setupDictionary["language"] = str(
                self.cmbLanguage.codeForCurrentEntry())
            self.setupDictionary["pagesLocation"] = self.pagesDirectory
            self.setupDictionary["exportLocation"] = self.exportDirectory
            self.setupDictionary["templateLocation"] = self.templateLocation
            self.setupDictionary[
                "translationLocation"] = self.translationLocation

            # Finally, write the dictionary into the json file.
            self.writeConfig()
Example #9
0
def setWizardTitle(name):
    wizard.setWindowTitle(name)


def runWizard():
    #wizard.move(2100,200)  ## If you have two monitors
    #wizard.resize(360,240) ## Smaller Wizard box
    wizard.show()
    sys.exit(app.exec_())


#if __name__ == 'pywiz':
import sys
app = QApplication(sys.argv)
wizard = QWizard()
#wizard.setWindowTitle('Please use "setWindowTitle()" to give this wizard a title.')

if __name__ == '__main__':
    print("Useage: import pywiz\n\tpywiz.createPage(title,text)" +
          "\n\tpywiz.setWizardTitle(title)\n\tpywiz.runWizard()")

##  This code is a modified version of the following:
## https://github.com/baoboa/pyqt5/blob/master/examples/dialogs/trivialwizard.py
##
## Copyright (C) 2013 Riverbank Computing Limited.
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
## All rights reserved.
##
## This file is part of the examples of PyQt.
##