Exemple #1
0
    def __init__(self,parent):
        global dao
        super(CreateNewOrderDialog,self).__init__(parent)

        self.current_customer = None

        title = _("Create new order")
        self.setWindowTitle(title)
        top_layout = QVBoxLayout()
        self.title_widget = TitleWidget(title,self)
        top_layout.addWidget(self.title_widget)

        self.customer_plate_widget = CustomerPlateWidget(self)
        self.buttons = QDialogButtonBox()
        self.buttons.addButton( QDialogButtonBox.StandardButton.Cancel)
        self.buttons.addButton( QDialogButtonBox.Ok)

        hlayout = QHBoxLayout()

        self.customer_select = AutoCompleteComboBox(None, self, None)
        self.customer_select.section_width = None # [300]
        view = []
        keys = []
        ref = []
        customers = dao.customer_dao.all()
        for c in customers:
            view.append([c.fullname])
            keys.append(c.fullname)
            ref.append(c)
        session().close() # FIXME bad data layer / presentation layer separation here

        self.customer_select.make_model( view, keys, ref )

        self.customer_plate_widget.set_customer(customers[0])

        hlayout.addWidget(QLabel(_("Customer")), 0, Qt.AlignTop)
        hlayout.addWidget(self.customer_select, 0, Qt.AlignTop)
        hlayout.addWidget(self.customer_plate_widget, 1000, Qt.AlignTop)
        hlayout.addStretch()
        top_layout.addLayout(hlayout)

        # hlayout = QHBoxLayout()
        # self.order_select = AutoCompleteComboBox()
        # self.order_select.setEnabled(False)
        # self.order_select.section_width = [100,300]
        # hlayout.addWidget(QLabel(_("Clone order")))
        # self.enable_clone = QCheckBox()
        # hlayout.addWidget(self.enable_clone)
        # hlayout.addWidget(self.order_select)
        # hlayout.addStretch()
        # top_layout.addLayout(hlayout)

        top_layout.addStretch()
        top_layout.addWidget(self.buttons)
        self.setLayout(top_layout)
        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)

        # self.customer_select.activated.connect(self.customer_selected)
        self.customer_select.list_view.itemSelected.connect(self.customer_selected)
Exemple #2
0
    def __init__(self, parent):
        super(PresenceDialog, self).__init__(parent)

        self.model = QuickComboModel(None)

        self.tar_type_edit = TaskActionReportTypeComboBox("action_type",
                                                          _("Action"),
                                                          nullable=False)
        self.tar_type_edit.set_model(
            [TaskActionReportType.day_in, TaskActionReportType.day_out])
        self.start_time_edit = TimeStampEdit("start_time",
                                             _("Start time"),
                                             nullable=False)
        self.form_fields = [self.tar_type_edit, self.start_time_edit]

        form_layout = QFormLayout()
        form_layout.addRow(_("Action"), self.tar_type_edit.widget)
        form_layout.addRow(_("Start time"), self.start_time_edit.widget)

        self.buttons = QDialogButtonBox()
        self.buttons.addButton(QDialogButtonBox.Ok)
        self.buttons.addButton(QDialogButtonBox.Cancel)
        self.buttons.accepted.connect(self.save_and_accept)
        self.buttons.rejected.connect(self.cancel)

        top_layout = QVBoxLayout()
        top_layout.addLayout(form_layout)
        top_layout.addWidget(self.buttons)

        self.setLayout(top_layout)
Exemple #3
0
class ProfileCreation(QDialog):
    '''
    classdocs
    '''
    profileCreated = Signal(Athlete)

    def __init__(self):
        '''
        Constructor
        '''
        QDialog.__init__(self)

        self._initGUI()
        self.athleteProfile = False

    def _initGUI(self):
        self.setWindowTitle("Profile Creation")
        self.profileWidget = ProfileFormWidget()

        self.buttonBox = QDialogButtonBox(QDialogButtonBox.Cancel)
        self.okBtn = QPushButton("Ok")
        self.okBtn.setDefault(True)
        self.okBtn.clicked.connect(self._createProfile)
        self.buttonBox.addButton(self.okBtn, QDialogButtonBox.AcceptRole)

        vLayout = QVBoxLayout()
        vLayout.addWidget(QLabel("<h3>Create a new profile!</h3><hr>"))
        vLayout.addWidget(self.profileWidget)
        vLayout.addWidget(self.buttonBox)

        self.setLayout(vLayout)

    def _createProfile(self):
        athleteProfile = self.profileWidget.getProfile()
        self.profileCreated.emit(athleteProfile)
Exemple #4
0
    def __init__(self, parent, remote_documents_service):
        super(NonConformityDialog, self).__init__(parent)

        self._quality_widget = Nonconformity2Widget(self,
                                                    remote_documents_service)

        title = _("Create a non conformity")
        self.setWindowTitle(title)
        top_layout = QVBoxLayout()
        self.title_widget = TitleWidget(title, self)
        top_layout.addWidget(self.title_widget)

        self._explanation = QLabel()
        self._explanation.setWordWrap(True)
        top_layout.addWidget(self._explanation)

        top_layout.addWidget(self._quality_widget)

        self.buttons = QDialogButtonBox()
        self.buttons.addButton(QDialogButtonBox.Ok)
        self.buttons.addButton(QDialogButtonBox.Cancel)
        top_layout.addWidget(self.buttons)

        self.setLayout(top_layout)
        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)
Exemple #5
0
class VersionDialog(QDialog):
    def __init__(self, parent):
        super(VersionDialog, self).__init__()

        layout = QVBoxLayout(self)
        layout.addWidget(QLabel("Which version do you want to download ?"))

        self.line_edit = QLineEdit()
        layout.addWidget(self.line_edit)

        self.buttons = QDialogButtonBox()
        self.buttons.addButton(QDialogButtonBox.StandardButton.Cancel)
        self.buttons.addButton(QDialogButtonBox.Ok)
        layout.addWidget(self.buttons)

        self.setLayout(layout)

        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)

    @Slot()
    def accept(self):
        try:
            StrictVersion(self.line_edit.text())
            return super(VersionDialog, self).accept()
        except:
            pass

    @Slot()
    def reject(self):
        return super(VersionDialog, self).reject()
Exemple #6
0
class ProfileCreation(QDialog):
    '''
    classdocs
    '''
    profileCreated = Signal(Athlete)
    
    def __init__(self):
        '''
        Constructor
        '''
        QDialog.__init__(self)
        
        self._initGUI()
        self.athleteProfile = False
    
    def _initGUI(self):
        self.setWindowTitle("Profile Creation")
        self.profileWidget = ProfileFormWidget()
        
        self.buttonBox = QDialogButtonBox(QDialogButtonBox.Cancel)
        self.okBtn = QPushButton("Ok")
        self.okBtn.setDefault(True)
        self.okBtn.clicked.connect(self._createProfile)
        self.buttonBox.addButton(self.okBtn, QDialogButtonBox.AcceptRole)
        
        vLayout = QVBoxLayout()
        vLayout.addWidget(QLabel("<h3>Create a new profile!</h3><hr>"))
        vLayout.addWidget(self.profileWidget)
        vLayout.addWidget(self.buttonBox)
        
        self.setLayout(vLayout)        

    def _createProfile(self):
        athleteProfile = self.profileWidget.getProfile()
        self.profileCreated.emit(athleteProfile)
Exemple #7
0
class AskIPAddress(QDialog):
    def __init__(self, parent):
        super(AskIPAddress, self).__init__()

        layout = QVBoxLayout(self)
        layout.addWidget(QLabel("Please enter a valid address"))

        glayout = QGridLayout()

        self.address = QLineEdit()
        glayout.addWidget(QLabel("IP Address"), 0, 0)
        glayout.addWidget(self.address, 0, 1)

        self.address.setText(guess_server_public_ip())
        layout.addLayout(glayout)

        self.buttons = QDialogButtonBox()
        self.buttons.addButton(QDialogButtonBox.Ok)
        layout.addWidget(self.buttons)

        self.setLayout(layout)

        self.buttons.accepted.connect(self.accept)

    @Slot()
    def accept(self):
        return super(AskIPAddress, self).accept()
Exemple #8
0
    def __init__(self, parent):
        super(AboutDemoDialog, self).__init__(parent)

        title = _("Welcome to {}...").format(
            configuration.get("Globals", "name"))
        self.setWindowTitle(title)
        top_layout = QVBoxLayout()
        self.title_widget = TitleWidget(title, self)
        top_layout.addWidget(self.title_widget)

        text = QLabel(
            _("""
  <p>Welcome to the demo of {0}. This demo is fully functional and it
    comes with an example database. That should be enough to have a full
    tour of {0}.</p>
  <p>The first screen you'll see is a list of orders that were done
    in our imaginary company. If you double click on one of them,
    you'll see its details. From there on, you can browse around
    and test everything.</p>
  <p>As it is the demo version, all the data you'll change will be visible
    on internet. The demonstration database will be reased from time to time.</p>
  <p>Enjoy and feel free to contact us in case of problems :
    <a href="mailto:[email protected]">[email protected]</a></p>
""").format(configuration.get("Globals", "name")))
        text.setTextFormat(Qt.RichText)
        text.setWordWrap(True)
        top_layout.addWidget(text)

        self.buttons = QDialogButtonBox()
        self.buttons.addButton(QDialogButtonBox.Ok)

        top_layout.addWidget(self.buttons)
        self.setLayout(top_layout)
        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)
Exemple #9
0
class GiveNewNameDialog(QDialog):
    def __init__(self, parent):
        super(GiveNewNameDialog, self).__init__()

        self.setWindowTitle(_("Choose filter's name"))
        layout = QVBoxLayout(self)
        layout.addWidget(QLabel(_("Please give a name to the filter")))

        self.line_edit = QLineEdit()

        layout.addWidget(self.line_edit)

        self.buttons = QDialogButtonBox()
        self.buttons.addButton(QDialogButtonBox.StandardButton.Cancel)
        self.buttons.addButton(QDialogButtonBox.Ok)
        layout.addWidget(self.buttons)

        self.setLayout(layout)

        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)

    @Slot()
    def accept(self):
        if self.line_edit.text().strip():
            return super(GiveNewNameDialog, self).accept()

    @Slot()
    def reject(self):
        return super(GiveNewNameDialog, self).reject()
Exemple #10
0
    def __init__(self, parent):
        super(AddPeriodDialog, self).__init__(parent)

        t = _("Add a period for an operation definition")
        self.setWindowTitle(t)
        self.title_widget = TitleWidget(t, self)

        top_layout = QVBoxLayout()
        top_layout.addWidget(self.title_widget)

        hlayout = QHBoxLayout()
        hlayout.addWidget(QLabel(_("Start time"), self))
        self.date_edit = QLineEdit(self)
        hlayout.addWidget(self.date_edit)
        top_layout.addLayout(hlayout)

        hlayout = QHBoxLayout()
        hlayout.addWidget(QLabel(_("Hourly cost"), self))
        self.hourly_cost = QLineEdit(self)
        hlayout.addWidget(self.hourly_cost)
        top_layout.addLayout(hlayout)

        self.buttons = QDialogButtonBox()
        self.buttons.addButton(QDialogButtonBox.Ok)
        top_layout.addWidget(self.buttons)

        self.setLayout(top_layout)  # QWidget takes ownership of the layout

        self.buttons.accepted.connect(self.accepted)
Exemple #11
0
    def __init__(self,parent):
        global dao
        super(DeleteLastDeliverySlipDialog,self).__init__(parent)

        title = _("Delete the last delivery slip")
        self.setWindowTitle(title)

        top_layout = QVBoxLayout()
        self.title_widget = TitleWidget(title,self)
        top_layout.addWidget(self.title_widget)

        self.info_label = QLabel()
        self.info_label.setWordWrap(True)
        top_layout.addWidget(self.info_label)

        self.buttons = QDialogButtonBox()
        self.buttons.addButton( QDialogButtonBox.StandardButton.Cancel)
        self.buttons.addButton( QDialogButtonBox.Ok)

        top_layout.addWidget(self.buttons)

        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)

        self.setLayout(top_layout)
Exemple #12
0
    def initialize(self, words):
        self.removeComboBox = QComboBox()
        self.removeComboBox.addItems(words)
        self.tooltips.append((self.removeComboBox, """\
<p><b>Spelling Words combobox</b></p>
<p>This index's list of words that have been remembered as correctly
spelled or to be ignored even though they aren't in the dictionary for
the index's language.</p>"""))
        self.helpButton = QPushButton(QIcon(":/help.svg"), "Help")
        self.tooltips.append((self.helpButton,
                              "Help on the Forget Spelling Words dialog"))
        self.removeButton = QPushButton(QIcon(":/spelling-remove.svg"),
                                        "&Forget")
        self.tooltips.append((self.removeButton, """\
<p><b>Forget</b></p>
<p>Permanently forget the selected word from the index's spelling words
list. Afterwards, if this word appears in any entry, it will be
highlighted as misspelled.</p>"""))
        closeButton = QPushButton(QIcon(":/dialog-close.svg"),
                                  "&Close")
        self.tooltips.append((closeButton, """<p><b>Close</b></p>
<p>Close the dialog.</p>"""))
        self.buttonBox = QDialogButtonBox()
        self.buttonBox.addButton(closeButton, QDialogButtonBox.RejectRole)
        self.buttonBox.addButton(
            self.removeButton, QDialogButtonBox.ApplyRole)
        self.buttonBox.addButton(self.helpButton, QDialogButtonBox.HelpRole)
        layout = QFormLayout()
        layout.addRow("F&orget", self.removeComboBox)
        layout.addRow(self.buttonBox)
        self.setLayout(layout)
        self.helpButton.clicked.connect(self.help)
        self.removeButton.clicked.connect(self.remove)
        self.buttonBox.rejected.connect(self.reject)
Exemple #13
0
    def __init__(self, parent=None):
        super(TemplateSelectDialog, self).__init__(parent)

        self.setWindowTitle(_("Select a template"))

        self.template_id = []

        self.model = QStandardItemModel()
        self.view = QTableView()
        self.view.setModel(self.model)
        self.view.verticalHeader().setVisible(False)
        self.view.horizontalHeader().setVisible(False)
        self.view.setMinimumSize(500, 200)
        self.view.setShowGrid(True)
        self.view.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.view.setSelectionBehavior(QAbstractItemView.SelectRows)

        l = QVBoxLayout()

        l.addWidget(QLabel(_("Please select one or more template.")))
        self.view.doubleClicked.connect(self._doubleClicked)

        l.addWidget(QLabel(u"<h3>{}</h3>".format(_("Documents Templates"))))
        l.addWidget(self.view)

        self.buttons = QDialogButtonBox()
        self.buttons.addButton(QDialogButtonBox.StandardButton.Cancel)
        self.buttons.addButton(QDialogButtonBox.Ok)
        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)

        l.addWidget(self.buttons)

        self.setLayout(l)
    def __init__(self, parent, doc_service):
        super(TemplatesCollectionWidgetDialog, self).__init__(parent)
        layout = QVBoxLayout()

        self.setWindowTitle(_("Templates library"))

        tw = TitleWidget(_("Templates library"), self)
        layout.addWidget(tw)
        l = QLabel(
            _("Here you can add or remove templates documents from the library. "
              "If needed, you can change their name and add a description. "
              "If you want to replace a reference document (one with a special "
              "Horse reference, then simply drag and drop the document on "
              "the appropriate row"))

        l.setWordWrap(True)
        layout.addWidget(l)

        self.widget = TemplatesCollectionWidget(self, doc_service)
        layout.addWidget(self.widget)

        self.buttons = QDialogButtonBox()
        self.buttons.addButton(QDialogButtonBox.Ok)
        self.buttons.accepted.connect(self.accept)
        layout.addWidget(self.buttons)

        self.setLayout(layout)
        place_dialog_on_screen(self, 0.5, 0.7)
Exemple #15
0
    def __init__(self, info_text, no_date_allowed = True):
        super(DatePick, self).__init__()

        self.accepted_date = None

        layout = QVBoxLayout()

        title = _("Pick a date")
        self.setWindowTitle(title)
        layout.addWidget(TitleWidget(title, self))

        self.info_label =QLabel(info_text)
        self.qw = QCalendarWidget()

        self.info_label.setWordWrap(True)
        self.info_label.setMaximumWidth(self.qw.minimumWidth())
        layout.addWidget( self.info_label)
        layout.addWidget( self.qw)
        self.qw.activated.connect(self.date_chosen)

        self.buttons = QDialogButtonBox()

        if no_date_allowed:
            self.buttons.addButton( QPushButton("No date"), QDialogButtonBox.ButtonRole.AcceptRole)

        self.buttons.addButton( QDialogButtonBox.StandardButton.Cancel)
        self.buttons.addButton( QDialogButtonBox.Ok)

        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)

        layout.addWidget(self.buttons)
        layout.addStretch()
        self.setLayout(layout)
Exemple #16
0
class YesConfirm(QDialog):
    def __init__(self, parent):
        super(YesConfirm, self).__init__()

        layout = QVBoxLayout(self)
        layout.addWidget(
            QLabel(
                "The following operation is irreversible. Type 'yes' to confirm"
            ))

        self.line_edit = QLineEdit()
        layout.addWidget(self.line_edit)

        self.buttons = QDialogButtonBox()
        self.buttons.addButton(QDialogButtonBox.StandardButton.Cancel)
        self.buttons.addButton(QDialogButtonBox.Ok)
        layout.addWidget(self.buttons)

        self.setLayout(layout)

        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)

    @Slot()
    def accept(self):
        if self.line_edit.text() == 'yes':
            return super(YesConfirm, self).accept()

    @Slot()
    def reject(self):
        return super(YesConfirm, self).reject()
Exemple #17
0
    def __init__(self, parent):
        global configuration
        super(EditConfigurationDialog, self).__init__(parent)

        title = _("Preferences")
        self.setWindowTitle(title)
        self.title_widget = TitleWidget(title, self)

        self.buttons = QDialogButtonBox()
        self.buttons.addButton(QDialogButtonBox.Ok)
        self.buttons.addButton(QDialogButtonBox.Cancel)

        self.font_select = QCheckBox()
        self.server_address = QLineEdit()

        form_layout = QFormLayout()
        form_layout.addRow(_("Fonts"), self.font_select)
        form_layout.addRow(_("Server's IP address"), self.server_address)

        top_layout = QVBoxLayout()
        top_layout.addWidget(self.title_widget)
        top_layout.addLayout(form_layout)
        top_layout.addWidget(self.buttons)

        self.setLayout(top_layout)  # QWidget takes ownership of the layout
        self.buttons.accepted.connect(self.save_and_accept)
        self.buttons.rejected.connect(self.cancel)

        self._load_configuration(configuration)
Exemple #18
0
    def createWidgets(self):
        self.termLabelLabel = QLabel("Term")
        self.termLabel = Widgets.Label.HtmlLabel()
        self.originalPagesLabel = Widgets.Label.HtmlLabel()
        self.originalPagesLabel.setStyleSheet(_BG_SAME)
        self.combinedPagesLabel = Widgets.Label.HtmlLabel()
        self.combinedPagesLabel.setStyleSheet(_BG_SAME)

        self.buttonBox = QDialogButtonBox()
        self.combineButton = QPushButton(QIcon(":/combinepages.svg"),
                                         "Co&mbine")
        self.tooltips.append((self.combineButton, """\
<p><b>Combine</b></p>
<p>Combine overlapping pages as shown, and move to the next term with
overlapping pages.</p>"""))
        self.buttonBox.addButton(self.combineButton,
                                 QDialogButtonBox.ActionRole)
        self.skipButton = QPushButton(QIcon(":/skip.svg"), "S&kip")
        self.tooltips.append((self.skipButton, """\
<p><b>Skip</b></p>
<p>Skip this term's overlapping pages, and move to the next term with
overlapping pages.</p>"""))
        self.buttonBox.addButton(self.skipButton, QDialogButtonBox.ActionRole)
        self.closeButton = QPushButton(QIcon(":/dialog-close.svg"), "&Close")
        self.tooltips.append((self.closeButton, """<p><b>Close</b></p>
<p>Close the dialog.</p>"""))
        self.buttonBox.addButton(self.closeButton, QDialogButtonBox.RejectRole)
        self.helpButton = QPushButton(QIcon(":/help.svg"), "Help")
        self.tooltips.append(
            (self.helpButton, "Help on the Combine Overlapping Pages dialog"))
        self.buttonBox.addButton(self.helpButton, QDialogButtonBox.HelpRole)
Exemple #19
0
    def createWidgets(self):
        self.fontLabel = QLabel("Fon&t:")
        self.fontComboBox = QFontComboBox()
        self.tooltips.append((self.fontComboBox, """\
<p><b>Font</b></p>
<p>The font for displaying the characters.</p>"""))
        self.fontLabel.setBuddy(self.fontComboBox)
        self.sizeLabel = QLabel("&Size:")
        self.sizeComboBox = QComboBox()
        self.tooltips.append((self.sizeComboBox, """\
<p><b>Size</b></p>
<p>The size of font for displaying the characters.</p>"""))
        self.sizeLabel.setBuddy(self.sizeComboBox)
        self.scrollArea = QScrollArea()
        self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.panel = Panel()
        self.scrollArea.setWidget(self.panel)
        self.copyTextLabel = QLabel("Copy T&ext")
        self.copyTextLineEdit = QLineEdit()
        self.tooltips.append((self.copyTextLineEdit, """\
<p><b>Copy Text editor</b></p>
<p>The text for copying to the clipboard when <b>Copy</b> is
pressed.</p>"""))
        self.copyTextLabel.setBuddy(self.copyTextLineEdit)
        self.findTextLabel = QLabel("&Find Text")
        self.findTextLineEdit = QLineEdit()
        self.tooltips.append((self.findTextLineEdit, """\
<p><b>Find Text editor</b></p>
<p>The name or partial name of Unicode characters to be found, e.g.,
“star” will match many characters, including U+22C6 “Star
operator”.</p>"""))
        self.findTextLabel.setBuddy(self.findTextLineEdit)
        self.buttonBox = QDialogButtonBox()
        self.addSelectedButton = QPushButton(QIcon(":/add.svg"),
                                             "&Add Selected")
        self.tooltips.append((self.addSelectedButton, """\
<p><b>Add Selected</b></p>
<p>Append the selected character to the <b>Copy Text</b> editor.</p>"""))
        self.buttonBox.addButton(self.addSelectedButton,
                                 QDialogButtonBox.ActionRole)
        self.findNextButton = QPushButton(QIcon(":/edit-find.svg"),
                                          "Find &Next")
        self.tooltips.append((self.findNextButton, """\
<p><b>Find Next</b></p>
<p>Find the next character whose Unicode name contains or equals the
<b>Find Text</b>.</p>"""))
        self.buttonBox.addButton(self.findNextButton,
                                 QDialogButtonBox.ActionRole)
        self.helpButton = QPushButton(QIcon(":/help.svg"), "Help")
        self.tooltips.append(
            (self.helpButton, "Help on the Copy Character dialog"))
        self.buttonBox.addButton(self.helpButton, QDialogButtonBox.HelpRole)
        self.closeButton = QPushButton(QIcon(":/dialog-close.svg"), "&Close")
        self.tooltips.append((self.closeButton, """<p><b>Cancel</b></p>
<p>Close the dialog.</p>"""))
        self.buttonBox.addButton(self.closeButton, QDialogButtonBox.RejectRole)
Exemple #20
0
 def _createButtonBox(self):
     
     box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
     
     self._okButton = box.button(QDialogButtonBox.Ok)
     
     box.accepted.connect(self.accept)
     box.rejected.connect(self.reject)
     
     return box
    def createButtonBox(self):
        self.buttonBox = QDialogButtonBox()

        closeButton = self.buttonBox.addButton(QDialogButtonBox.Close)
        helpButton = self.buttonBox.addButton(QDialogButtonBox.Help)
        rotateWidgetsButton = self.buttonBox.addButton("Rotate &Widgets", QDialogButtonBox.ActionRole)

        rotateWidgetsButton.clicked.connect(self.rotateWidgets)
        closeButton.clicked.connect(self.close)
        helpButton.clicked.connect(self.show_help)
Exemple #22
0
 def layoutWidgets(self):
     buttonBox = QDialogButtonBox()
     buttonBox.addButton(self.recreateButton, QDialogButtonBox.ActionRole)
     buttonBox.addButton(self.deleteButton, QDialogButtonBox.ActionRole)
     buttonBox.addButton(self.closeButton, QDialogButtonBox.AcceptRole)
     buttonBox.addButton(self.helpButton, QDialogButtonBox.HelpRole)
     layout = QVBoxLayout()
     layout.addWidget(self.listWidget)
     layout.addWidget(self.recreateSubentriesCheckBox)
     layout.addWidget(buttonBox)
     self.setLayout(layout)
Exemple #23
0
class AboutDialog(QDialog):
    def __init__(self, parent):
        super(AboutDialog, self).__init__(parent)

        title = _("About {}...").format(configuration.get("Globals", "name"))
        self.setWindowTitle(title)
        top_layout = QVBoxLayout()
        self.title_widget = TitleWidget(title, self)
        top_layout.addWidget(self.title_widget)

        text = QLabel(u"{}<br/>Version : {}<br/><br/>".format(
            copyright(), str(configuration.this_version)) +
                      _("""This program is given to you with a few important
freedoms and duties as specified in the license below. <b>We believe they will help to make a better world</b>. They are
also <b>legally binding</b> (see Free Software Foundation's website), so make sure you read the license
carefully. We give you the right to
<ul>
<li>run the program,</li>
<li>inspect it to make sure it is safe to use,</li>
<li>modify it to suit your needs,</li>
<li>distribute copies of it,</li>
</ul>
as long as you give those freedoms and duties to anybody you give this program to.
"""))
        text.setTextFormat(Qt.RichText)
        text.setWordWrap(True)
        # text.setMaximumWidth(400)
        top_layout.addWidget(text)

        browser = QTextBrowser()
        browser.setLineWrapMode(QTextEdit.NoWrap)
        browser.setPlainText(license())
        browser.setMinimumWidth(browser.document().documentLayout().
                                documentSize().toSize().width())
        browser.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        top_layout.addWidget(browser)

        self.buttons = QDialogButtonBox()
        self.buttons.addButton(QDialogButtonBox.Ok)

        top_layout.addWidget(self.buttons)
        self.setLayout(top_layout)
        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)

    @Slot()
    def accept(self):
        self.deleteLater()
        return super(AboutDialog, self).accept()

    @Slot()
    def reject(self):
        self.deleteLater()
        return super(AboutDialog, self).reject()
Exemple #24
0
    def __init__(self,parent):
        global dao
        super(EditDeliverySlipDialog,self).__init__(parent)

        title = _("Create delivery slip")
        self.setWindowTitle(title)

        top_layout = QVBoxLayout()
        self.title_widget = TitleWidget(title,self)
        top_layout.addWidget(self.title_widget)

        self.info_label = QLabel()
        self.info_label.setWordWrap(True)
        top_layout.addWidget(self.info_label)

        self.buttons = QDialogButtonBox()
        self.buttons.addButton( QDialogButtonBox.StandardButton.Cancel)
        self.buttons.addButton( QDialogButtonBox.Ok)

        order_part_prototype = []
        order_part_prototype.append( TextLinePrototype('human_identifier',_('Part n.'),editable=False))
        order_part_prototype.append( TextLinePrototype('description',_('Description'),editable=False))
        order_part_prototype.append( IntegerNumberPrototype('qty',_('Qty plan.'),editable=False))
        order_part_prototype.append( IntegerNumberPrototype('tex2',_('Qty so far'),editable=False))
        order_part_prototype.append( IntegerNumberPrototype(None,_('Qty out now'),nullable=True))
        self.qty_out_column = len(order_part_prototype) - 1

        # order_part_prototype.append( IntegerNumberPrototype(None,_('Reglages'),nullable=True))
        # order_part_prototype.append( IntegerNumberPrototype(None,_('Derogation'),nullable=True))
        # order_part_prototype.append( IntegerNumberPrototype(None,_('Rebus'),nullable=True))


        self.controller_part = PrototypeController(self, order_part_prototype,None,freeze_row_count=True)
        self.controller_part.view.horizontalHeader().setResizeMode(QHeaderView.ResizeToContents)
        self.controller_part.view.horizontalHeader().setResizeMode(1,QHeaderView.Stretch)


        self.controller_part.setModel(TrackingProxyModel(self,order_part_prototype))
        self.close_order_checkbox = QCheckBox(_("Close the order"))

        top_layout.addWidget(self.controller_part.view) # self.time_tracks_view)
        # top_layout.addWidget(self._make_units_qaulifications_gui())
        top_layout.addWidget(self.close_order_checkbox)
        top_layout.addWidget(self.buttons)
        self.setLayout(top_layout)

        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)

        sg = QDesktopWidget().screenGeometry()
        self.setMinimumWidth(0.5*sg.width())
        self.setMinimumHeight(0.3*sg.height())

        self.slip_id = None
Exemple #25
0
    def __init__(self,parent):
        global dao
        super(FindOrderDialog,self).__init__(parent)

        title = _("Find order")
        self.setWindowTitle(title)
        top_layout = QVBoxLayout()
        self.title_widget = TitleWidget(title,self)
        top_layout.addWidget(self.title_widget)

        hlayout = QHBoxLayout()
        hlayout.addWidget(QLabel(_("Search")))
        self.search_criteria = QLineEdit()
        self.search_criteria.setObjectName("search_criteria")
        hlayout.addWidget(self.search_criteria)
        top_layout.addLayout(hlayout)



        self.search_results_view = QTableView()

        self.headers_view = QHeaderView(Qt.Orientation.Horizontal)
        self.header_model = make_header_model([_("Preorder Nr"),_("Order Nr"),_("Customer Nr"),_("Customer"),_("Order Part")])
        self.headers_view.setModel(self.header_model) # qt's doc : The view does *not* take ownership (bt there's something with the selecion mode

        self.search_results_model = QStandardItemModel()
        self.search_results_view.setModel(self.search_results_model)

        self.search_results_view.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.search_results_view.setHorizontalHeader(self.headers_view)
        self.search_results_view.verticalHeader().hide()
        # self.search_results_view.horizontalHeader().setResizeMode(QHeaderView.ResizeToContents)
        self.search_results_view.horizontalHeader().setResizeMode(3, QHeaderView.Stretch)
        self.search_results_view.horizontalHeader().setResizeMode(4, QHeaderView.Stretch)

        self.search_results_view.setSelectionBehavior(QAbstractItemView.SelectRows)

        self.buttons = QDialogButtonBox()
        self.buttons.addButton( QDialogButtonBox.StandardButton.Cancel)
        self.buttons.addButton( QDialogButtonBox.Ok)
        self.buttons.button(QDialogButtonBox.Ok).setObjectName("go_search")

        top_layout.addWidget(self.search_results_view)
        top_layout.setStretch(2,1000)
        top_layout.addWidget(self.buttons)
        self.setLayout(top_layout)

        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)
        self.search_results_view.activated.connect(self.row_activated)
        self.search_criteria.returnPressed.connect(self.search_criteria_submitted)

        self.setMinimumSize(800,640)
Exemple #26
0
    def __init__(self, parent):
        super(TimeEditDialog, self).__init__(parent)

        self.in_validation = False
        self.last_validated_identifier = None

        self.identifier_editor = OrderPartIdentifierEdit("identifier",
                                                         _("identifier"),
                                                         parent=self)
        self.identifier_editor.widget.editingFinished.connect(
            self.identifier_set)

        # self.identifier_widget = QLineEdit(self)
        # self.identifier_widget_validator = OrderPartIdentifierValidator()
        # self.identifier_widget.setValidator(self.identifier_widget_validator)
        # self.identifier_widget.editingFinished.connect(self.identifier_set)

        self.task_widget = AutoCompleteComboBox(None, self)
        self.task_widget.section_width = [300]
        self.task_widget.currentIndexChanged.connect(self.operation_set)

        self.tar_type_editor = TaskActionReportTypeComboBox(
            "tar_type", _("Action"))
        self.tar_type_editor.set_model(
            [TaskActionReportType.start_task, TaskActionReportType.stop_task])

        self.machine_editor = ConstrainedMachineEdit("machine_id",
                                                     _("Machine"))
        # self.machine_editor = AutoCompleteComboBox(None,self)
        # self.machine_editor.set_model(machine_service.find_machines_for_operation_definition(proxy.operation_definition_id))

        self.start_time_editor = TimeStampEdit("start_time",
                                               _("Start time"),
                                               nullable=False)

        form_layout = QFormLayout()
        form_layout.addRow(_("Identifier"), self.identifier_editor.widget)
        form_layout.addRow(_("Task"), self.task_widget)
        form_layout.addRow(_("Machine"), self.machine_editor.widget)
        form_layout.addRow(_("Action"), self.tar_type_editor.widget)
        form_layout.addRow(_("Start time"), self.start_time_editor.widget)
        top_layout = QVBoxLayout()
        top_layout.addLayout(form_layout)

        self.buttons = QDialogButtonBox()
        self.buttons.addButton(QDialogButtonBox.Ok)
        self.buttons.addButton(QDialogButtonBox.Cancel)

        top_layout.addWidget(self.buttons)
        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.cancel)

        self.setLayout(top_layout)
Exemple #27
0
class HelpDialog(QDialog):
    def __init__(self,parent):
        super(HelpDialog,self).__init__(parent)

        title = _("A bit of help")
        self.setWindowTitle(title)
        top_layout = QVBoxLayout()
        self.title_widget = TitleWidget(title,self)
        top_layout.addWidget(self.title_widget)

        browser = QTextBrowser()

        import os.path
        from koi.Configurator import resource_dir

        with open( os.path.join(resource_dir,"manual.html"), encoding='utf-8') as input:
            html = input.read()
        browser.setHtml(html)

        # browser.setLineWrapMode(QTextEdit.NoWrap)
        #         browser.setHtml("""<h1>Tables</h1>
        #
        # In tables you can edit, don't forget these few useful shortcuts :
        # <ul>
        # <li><b>F5</b> : will insert a line under your cursor</li>
        # <li><b>Shift + F5</b> : will append a line at the end of the table</li>
        # <li><b>F8</b> : will delete the line under your cursor (if you're allowed to)</li>
        # <li><b>F1</b> and <b>Shift + F1</b> : will allow you to move up/move down a row </li>
        # </ul>
        # """)
        # browser.setMinimumWidth(browser.document().documentLayout().documentSize().toSize().width())
        browser.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        top_layout.addWidget(browser)

        self.buttons = QDialogButtonBox()
        self.buttons.addButton( QDialogButtonBox.Ok)

        top_layout.addWidget(self.buttons)
        self.setLayout(top_layout)
        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)

    @Slot()
    def accept(self):
        self.deleteLater()
        return super(HelpDialog,self).accept()

    @Slot()
    def reject(self):
        self.deleteLater()
        return super(HelpDialog,self).reject()
Exemple #28
0
 def layoutWidgets(self):
     layout = QVBoxLayout()
     hbox = QHBoxLayout()
     hbox.addWidget(self.filenameLabelLabel)
     hbox.addWidget(self.filenameLabel, 1)
     hbox.addWidget(self.filenameButton)
     layout.addLayout(hbox)
     grid = QGridLayout()
     grid.addWidget(self.configCheckBox, 0, 0)
     grid.addWidget(self.autoReplaceCheckBox, 0, 1)
     grid.addWidget(self.spellWordsCheckBox, 1, 0)
     grid.addWidget(self.ignoredFirstWordsCheckBox, 1, 1)
     grid.addWidget(self.groupsCheckBox, 2, 0)
     grid.addWidget(self.customMarkupCheckBox, 2, 1)
     hbox = QHBoxLayout()
     hbox.addLayout(grid)
     hbox.addStretch()
     self.copyGroupBox.setLayout(hbox)
     layout.addWidget(self.copyGroupBox)
     layout.addStretch()
     buttonBox = QDialogButtonBox()
     buttonBox.addButton(self.newCopyButton, QDialogButtonBox.AcceptRole)
     buttonBox.addButton(self.cancelButton, QDialogButtonBox.RejectRole)
     buttonBox.addButton(self.helpButton, QDialogButtonBox.HelpRole)
     layout.addWidget(buttonBox)
     self.setLayout(layout)
Exemple #29
0
class NonConformityDialog(QDialog):
    def set_blank_quality_issue(self, kind, order_part_id):
        order_part_dto = dao.order_part_dao.find_by_id_frozen(order_part_id)
        self.current_qe = make_quality_event_dto(kind,
                                                 order_part_dto.order_part_id)
        self._explanation.setText(
            _("<p>Please fill in some details about the non conformity. This non conformity is concerns</p> <p> <b>{}</b> : {}</p>"
              ).format(order_part_dto.human_identifier,
                       order_part_dto.description))
        self._quality_widget.set_quality_issue(self.current_qe)

    def quality_event(self):
        return self.current_qe

    def __init__(self, parent, remote_documents_service):
        super(NonConformityDialog, self).__init__(parent)

        self._quality_widget = Nonconformity2Widget(self,
                                                    remote_documents_service)

        title = _("Create a non conformity")
        self.setWindowTitle(title)
        top_layout = QVBoxLayout()
        self.title_widget = TitleWidget(title, self)
        top_layout.addWidget(self.title_widget)

        self._explanation = QLabel()
        self._explanation.setWordWrap(True)
        top_layout.addWidget(self._explanation)

        top_layout.addWidget(self._quality_widget)

        self.buttons = QDialogButtonBox()
        self.buttons.addButton(QDialogButtonBox.Ok)
        self.buttons.addButton(QDialogButtonBox.Cancel)
        top_layout.addWidget(self.buttons)

        self.setLayout(top_layout)
        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)

    @Slot()
    def accept(self):
        return super(NonConformityDialog, self).accept()

    @Slot()
    def reject(self):
        return super(NonConformityDialog, self).reject()
Exemple #30
0
class ExportPdfOptionDialog(QDialog):
    """
    Displays options UI for the PDF
    """

    def __init__(self, parent=None):
        if not parent:
            parent = hiero.ui.mainWindow()
        super(ExportPdfOptionDialog, self).__init__(parent)

        layout = QFormLayout()
        self._fileNameField = FnFilenameField(False, isSaveFile=False, caption="Set PDF name", filter="*.pdf")
        self._fileNameField.setFilename(os.path.join(os.getenv("HOME"), "Desktop", "Sequence.pdf"))
        self._optionDropdown = QComboBox()
        self._buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        self._buttonbox.button(QDialogButtonBox.Ok).setText("Export")
        self._buttonbox.accepted.connect(self.accept)
        self._buttonbox.rejected.connect(self.reject)

        self._pdfActionSettings = {"1 Shot per page": [1, 1], "4 Shots per page)": [2, 2], "9 Shots per page)": [3, 3]}

        for pdfMode in sorted(self._pdfActionSettings, reverse=True):
            self._optionDropdown.addItem(pdfMode)

        layout.addRow("Save to:", self._fileNameField)
        layout.addRow("PDF Layout:", self._optionDropdown)
        layout.addRow("", self._buttonbox)

        self.setLayout(layout)
        self.setWindowTitle("Export PDF Options")
        self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)

    def numRows(self):
        """Returns the number of rows for the pdf"""
        optionText = self._optionDropdown.currentText()
        return self._pdfActionSettings[optionText][0]

    def numColumns(self):
        """Returns the number of columns for the pdf"""
        optionText = self._optionDropdown.currentText()
        return self._pdfActionSettings[optionText][1]

    def filePath(self):
        """Returns the filepath for the pdf"""
        filename = self._fileNameField.filename()
        if not filename.endswith(".pdf"):
            filename = filename + ".pdf"
        return filename
    def createButtonBox(self):
        self.buttonBox = QDialogButtonBox()

        closeButton = self.buttonBox.addButton(QDialogButtonBox.Close)
        helpButton = self.buttonBox.addButton(QDialogButtonBox.Help)
        closeButton.clicked.connect(self.close)
        helpButton.clicked.connect(self.show_help)
    def __init__(self, theScene, parent):
        """
        Default class constructor.

        :param `theScene`: TOWRITE
        :type `theScene`: QGraphicsScene
        :param `parent`: parent widget instance of this dialog.
        :type `parent`: QWidget
        """
        super(EmbDetailsDialog, self).__init__(parent)

        self.setMinimumSize(750, 550)

        self.getInfo()
        mainWidget = self.createMainWidget()

        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok)
        buttonBox.accepted.connect(self.accept)

        vboxLayoutMain = QVBoxLayout(self)
        vboxLayoutMain.addWidget(mainWidget)
        vboxLayoutMain.addWidget(buttonBox)
        self.setLayout(vboxLayoutMain)

        self.setWindowTitle(self.tr("Embroidery Design Details"))

        QApplication.setOverrideCursor(Qt.ArrowCursor)
Exemple #33
0
    def __init__(self, window, ok_handler, cancel_handler):
        super(SignInDialog, self).__init__(window)

        self.setWindowTitle("Login")
        self.setFixedSize(300, 130)
        self.setModal(True)

        self.layout = QGridLayout(self)

        self.username_label = QLabel(self)
        self.username_label.setText("Username:"******"Password:"******"Login")
        self.buttons.button(QDialogButtonBox.Cancel).setText("Cancel")
        self.buttons.button(QDialogButtonBox.Cancel).clicked.connect(cancel_handler)

        self.buttons.button(QDialogButtonBox.Ok).clicked.connect(
            lambda: ok_handler(self.edit_username.text(), self.edit_password.text()))

        self.layout.addWidget(self.username_label, 0, 0)
        self.layout.addWidget(self.edit_username, 0, 1)
        self.layout.addWidget(self.password_label, 1, 0)
        self.layout.addWidget(self.edit_password, 1, 1)
        self.layout.addWidget(self.buttons, 3, 0, 1, 2, Qt.AlignCenter)

        self.setLayout(self.layout)
Exemple #34
0
    def __init__(self, choices, title = "select one from choices", parent = None):
        super(ChoiceDialog, self).__init__(parent)

        layout = QVBoxLayout(self)
        self.choiceButtonGroup=QButtonGroup(parent)  # it is not a visible UI
        self.choiceButtonGroup.setExclusive(True)
        if choices and len(choices)>=1:
            self.choices = choices
            for id, choice in enumerate(self.choices):
                rb = QRadioButton(choice)
                self.choiceButtonGroup.addButton(rb)
                self.choiceButtonGroup.setId(rb, id)  # negative id if not specified
                layout.addWidget(rb)

        self.choiceButtonGroup.buttonClicked.connect(self.choiceChanged)
        # OK and Cancel buttons
        buttons = QDialogButtonBox(
            QDialogButtonBox.Ok | QDialogButtonBox.Cancel,
            Qt.Horizontal, self)
        buttons.accepted.connect(self.accept)
        buttons.rejected.connect(self.reject)
        layout.addWidget(buttons)

        self.setLayout(layout)
        self.setWindowTitle(title)
Exemple #35
0
    def __init__(self, parent=None):
        if not parent:
            parent = hiero.ui.mainWindow()
        super(ExportPdfOptionDialog, self).__init__(parent)

        layout = QFormLayout()
        self._fileNameField = FnFilenameField(False, isSaveFile=False, caption="Set PDF name", filter="*.pdf")
        self._fileNameField.setFilename(os.path.join(os.getenv("HOME"), "Desktop", "Sequence.pdf"))
        self._optionDropdown = QComboBox()
        self._buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        self._buttonbox.button(QDialogButtonBox.Ok).setText("Export")
        self._buttonbox.accepted.connect(self.accept)
        self._buttonbox.rejected.connect(self.reject)

        self._pdfActionSettings = {"1 Shot per page": [1, 1], "4 Shots per page)": [2, 2], "9 Shots per page)": [3, 3]}

        for pdfMode in sorted(self._pdfActionSettings, reverse=True):
            self._optionDropdown.addItem(pdfMode)

        layout.addRow("Save to:", self._fileNameField)
        layout.addRow("PDF Layout:", self._optionDropdown)
        layout.addRow("", self._buttonbox)

        self.setLayout(layout)
        self.setWindowTitle("Export PDF Options")
        self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
Exemple #36
0
        def __init__(self, parent, ok_handler, cancel_handler):
            super(AdminWidget.AddAccountDialog, self).__init__(parent)

            self.setWindowTitle("Add account")
            self.setFixedSize(300, 100)
            self.setModal(True)

            self.layout = QGridLayout(self)

            self.username_label = QLabel(self)
            self.username_label.setText("Username")
            self.edit_username = QLineEdit(self)

            self.buttons = QDialogButtonBox(self)
            self.buttons.addButton(QDialogButtonBox.Ok)
            self.buttons.addButton(QDialogButtonBox.Cancel)
            self.buttons.button(QDialogButtonBox.Ok).setText("Add")
            self.buttons.button(QDialogButtonBox.Cancel).setText("Cancel")
            self.buttons.button(QDialogButtonBox.Cancel).clicked.connect(cancel_handler)
            self.buttons.button(QDialogButtonBox.Ok).clicked.connect(lambda: ok_handler(self.edit_username.text()))

            self.layout.addWidget(self.username_label, 0, 0)
            self.layout.addWidget(self.edit_username, 0, 1)
            self.layout.addWidget(self.buttons, 1, 0, 1, 2, Qt.AlignCenter)

            self.setLayout(self.layout)
Exemple #37
0
    def __init__(self, parent=None):
        super(AddDialogWidget, self).__init__(parent)

        nameLabel = QLabel("Name")
        addressLabel = QLabel("Address")
        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok
                                     | QDialogButtonBox.Cancel)

        self.nameText = QLineEdit()
        self.addressText = QTextEdit()

        grid = QGridLayout()
        grid.setColumnStretch(1, 2)
        grid.addWidget(nameLabel, 0, 0)
        grid.addWidget(self.nameText, 0, 1)
        grid.addWidget(addressLabel, 1, 0, Qt.AlignLeft | Qt.AlignTop)
        grid.addWidget(self.addressText, 1, 1, Qt.AlignLeft)

        layout = QVBoxLayout()
        layout.addLayout(grid)
        layout.addWidget(buttonBox)

        self.setLayout(layout)

        self.setWindowTitle("Add a Contact")

        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)
Exemple #38
0
    def __init__(self, playersOut, playersIn, parent=None):
        super(confirmSubsDialog, self).__init__(parent)
        
        self.now = QDateTime.currentDateTime()
        self.now.setTime(QTime(self.now.time().hour(), self.now.time().minute()))
        
        self.setWindowTitle("Confirm Subs")
        mainVerticalLayout = QVBoxLayout(self)
        
        subsLayout = QGridLayout()
        mainVerticalLayout.addLayout(subsLayout)
        
        subsLayout.addWidget(QLabel("<b>Players Out</b>"), 0, 0)
        subsLayout.addWidget(QLabel("<b>Players In</b>"), 0, 1)

        for i, (playerOut, playerIn) in enumerate(zip(playersOut, playersIn)):
            playerOutLabel = QLabel()
            playerOutLabel.setText("<font color=red>{0}</font>".format(playerOut.name))
            subsLayout.addWidget(playerOutLabel, i+1, 0)
            
            playerInLabel = QLabel()
            playerInLabel.setText("<font color=green>{0}</font>".format(playerIn.name))
            subsLayout.addWidget(playerInLabel, i+1, 1)
            
        mainVerticalLayout.addItem(QSpacerItem(0, 15, QSizePolicy.Minimum, QSizePolicy.Expanding))
        
        dateTimeLayout = QHBoxLayout()
        mainVerticalLayout.addLayout(dateTimeLayout)
        dateTimeLayout.addWidget(QLabel("Date and time"))
        
        self.dateTimeEdit = QDateTimeEdit(self.now)
        self.dateTimeEdit.setMaximumDateTime(self.now)
        self.dateTimeEdit.setCalendarPopup(True)
        self.dateTimeEdit.setDisplayFormat("d MMM yy h:mm AP")
        
        dateTimeLayout.addWidget(self.dateTimeEdit)
        dateTimeLayout.addStretch()
        
        mainVerticalLayout.addItem(QSpacerItem(0, 10, QSizePolicy.Minimum, QSizePolicy.Expanding))
        
        buttonBox = QDialogButtonBox(self)
        buttonBox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Ok)
        buttonBox.button(QDialogButtonBox.Ok).setText("&Accept")
        mainVerticalLayout.addWidget(buttonBox)

        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)
 def createButtons(self):
     buttonsDialog = QDialogButtonBox(self)
     buttonsDialog.setStandardButtons(
         QDialogButtonBox.Save |
         QDialogButtonBox.Cancel |
         QDialogButtonBox.Reset)
     self.grid.addWidget(buttonsDialog, 3, 0, 3, 9)
     buttonsDialog.button(QDialogButtonBox.Save).clicked.connect(
         self.saveFile)
     buttonsDialog.button(QDialogButtonBox.Reset).clicked.connect(
         self.PaintArea.clearImage)
     buttonsDialog.button(QDialogButtonBox.Cancel).clicked.connect(
         self.close)
Exemple #40
0
    def _create_buttons(self, dialog, layout):
        """ Creates the buttons. """

        if not (self.can_cancel or self.can_ok):
            return

        # Create the button.
        buttons = QDialogButtonBox()

        if self.can_cancel:
            cancel_button = buttons.addButton(self.cancel_button_label, QDialogButtonBox.RejectRole)
            cancel_button.clicked.connect(self.cancel)
        if self.can_ok:
            ok_button = buttons.addButton(QDialogButtonBox.Ok)
            ok_button.clicked.connect(self.accept)

        layout.addWidget(buttons)
Exemple #41
0
class addawrd(QDialog):
	def __init__(self, parent=None):
		super(addawrd, self).__init__(parent)
		appicom = QIcon(":/icons/njnlogo.png")
		self.setWindowIcon(appicom)
		self.setWindowTitle("Nigandu | Add a word")
		self.setFixedSize(364, 188)

		self.horizontalLayoutWidget = QWidget(self)
		self.horizontalLayoutWidget.setGeometry(QRect(10, 10, 341, 61))
		self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget")

		self.horizontalLayout = QHBoxLayout(self.horizontalLayoutWidget)
		self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
		self.horizontalLayout.setObjectName("horizontalLayout")

		self.label = QLabel(self.horizontalLayoutWidget)
		self.label.setMinimumSize(QSize(70, 25))
		self.horizontalLayout.addWidget(self.label)
		self.label.setText("English Word:")

		self.lineEdit = QLineEdit(self.horizontalLayoutWidget)
		self.lineEdit.setEnabled(True)
		self.lineEdit.setMinimumSize(QSize(0, 25))
		self.lineEdit.setObjectName("lineEdit_2")
		self.horizontalLayout.addWidget(self.lineEdit)
		self.lineEdit.setFocus()

		self.buttonBox = QDialogButtonBox(self)
		self.buttonBox.setGeometry(QRect(10, 150, 341, 25))
		self.buttonBox.setMinimumSize(QSize(70, 25))
		self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Save)
		self.buttonBox.setObjectName("buttonBox")

		self.horizontalLayoutWidget_2 = QWidget(self)
		self.horizontalLayoutWidget_2.setGeometry(QRect(10, 80, 341, 61))
		self.horizontalLayoutWidget_2.setObjectName("horizontalLayoutWidget_2")
		self.horizontalLayout_2 = QHBoxLayout(self.horizontalLayoutWidget_2)
		self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
		self.horizontalLayout_2.setObjectName("horizontalLayout_2")

		self.label_2 = QLabel(self.horizontalLayoutWidget_2)
		self.label_2.setMinimumSize(QSize(70, 25))
		self.label_2.setObjectName("label_2")
		self.horizontalLayout_2.addWidget(self.label_2)
		self.label_2.setText("Tamil Word:")

		self.lineEdit_2 = QLineEdit(self.horizontalLayoutWidget_2)
		self.lineEdit_2.setMinimumSize(QSize(0, 25))
		self.lineEdit_2.setObjectName("lineEdit_3")
		self.horizontalLayout_2.addWidget(self.lineEdit_2)

		self.setTabOrder(self.lineEdit, self.lineEdit_2)
		self.setTabOrder(self.lineEdit_2, self.buttonBox)
Exemple #42
0
    def createButtonBox(self):
        self.buttonBox = QDialogButtonBox()

        closeButton = self.buttonBox.addButton(QDialogButtonBox.Close)
        helpButton = self.buttonBox.addButton(QDialogButtonBox.Help)
        rotateWidgetsButton = self.buttonBox.addButton("Rotate &Widgets", QDialogButtonBox.ActionRole)

        rotateWidgetsButton.clicked.connect(self.rotateWidgets)
        closeButton.clicked.connect(self.close)
        helpButton.clicked.connect(self.show_help)
Exemple #43
0
    def __init__(self, items):  # , parent=None
        super(MultiListDialog, self).__init__()  # parent
        self.resize(800, 550)
        self.entries = items
        layout = QVBoxLayout(self)

        self.listWidget = QListWidget(self)
        self.listWidget.setSelectionMode(QAbstractItemView.ExtendedSelection)

        self.HlineInputfiles = ConfigLineDir(u"Verzeichnis NI XML:", "dir")
        self.HlineOutputfiles = ConfigLineDir(u"Verzeichnis Report:", "dir")
        if os.path.isfile(PICKLE_TEMP_FILE):
            pkl_file = open(PICKLE_TEMP_FILE, 'rb')
            inPath = pickle.load(pkl_file)
            outPath = pickle.load(pkl_file)
            pkl_file.close()
            if os.path.isdir(inPath):
                self.HlineInputfiles.editText.setText(inPath)
            if os.path.isdir(outPath):
                self.HlineOutputfiles.editText.setText(outPath)
        layout.addLayout(self.HlineInputfiles)
        layout.addLayout(self.HlineOutputfiles)
        layout.addWidget(self.listWidget)

        layout.addWidget(QLabel("Mehrfachauswahl -> Strg + Mausklick"))

        # OK and Cancel buttons
        buttons = QDialogButtonBox(QDialogButtonBox.Apply | QDialogButtonBox.Close, Qt.Horizontal, self)
        # Apply before Close
        buttons.setStyleSheet("* { button-layout: 2 }")
        layout.addWidget(buttons)

        buttons.rejected.connect(self.close)
        buttons.button(QDialogButtonBox.Apply).clicked.connect(self.Apply_Clicked)

        self.SetListItems()
        self.HlineInputfiles.editText.textChanged.connect(self.RefreshList)
        self.HlineInputfiles.editText.textChanged.connect(self.SetListItems)
Exemple #44
0
    def __init__(self, players, oldFormation, newFormation, parent=None):
        super(changeFormationDialog, self).__init__(parent)

        self.players = players
        self.formationChanges = oldFormation-newFormation
        
        self.setWindowTitle("Change Formation")
        
        mainVerticalLayout = QVBoxLayout(self)
        
        self.allCheckBoxes = []
        for i,p in enumerate(self.formationChanges):
            checkBoxes = {}
            if p > 0:
                outLabel = QLabel()
                text = "<b>Choose {0} {1}"
                if p > 1:    
                    text+="s"
                text += " to drop</b>"
                position = Formation.labels[i]
                outLabel.setText(text.format(p, position.lower()))
                mainVerticalLayout.addWidget(outLabel)
                #subsLayout.addWidget(outLabel, 0, 0)
                for player in [player for player in players if player.position == position]:
                    checkBox = QCheckBox("{0} {1}".format(str(player), player.value))
                    checkBoxes[player] = checkBox
                    mainVerticalLayout.addWidget(checkBox)
            self.allCheckBoxes.append(checkBoxes)

        buttonBox = QDialogButtonBox(self)
        buttonBox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Ok)
        buttonBox.button(QDialogButtonBox.Ok).setText("&Accept")
        mainVerticalLayout.addWidget(buttonBox)

        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)
Exemple #45
0
 def _initGUI(self):
     self.setWindowTitle("Profile Creation")
     self.profileWidget = ProfileFormWidget()
     
     self.buttonBox = QDialogButtonBox(QDialogButtonBox.Cancel)
     self.okBtn = QPushButton("Ok")
     self.okBtn.setDefault(True)
     self.okBtn.clicked.connect(self._createProfile)
     self.buttonBox.addButton(self.okBtn, QDialogButtonBox.AcceptRole)
     
     vLayout = QVBoxLayout()
     vLayout.addWidget(QLabel("<h3>Create a new profile!</h3><hr>"))
     vLayout.addWidget(self.profileWidget)
     vLayout.addWidget(self.buttonBox)
     
     self.setLayout(vLayout)        
    def _create_buttons ( self, dialog, layout ):
        """ Creates the buttons.
        """
        # Create the button:
        buttons = QDialogButtonBox()

        if self.can_cancel:
            buttons.addButton( self.cancel_button_label,
                               QDialogButtonBox.RejectRole )

        buttons.addButton( QDialogButtonBox.Ok )

        # TODO: hookup the buttons to our methods, this may involve subclassing
        # from QDialog

        if self.can_cancel:
            buttons.connect( buttons, SIGNAL( 'rejected()' ), dialog,
                             SLOT( 'reject() ' ) )
        buttons.connect( buttons, SIGNAL( 'accepted()' ), dialog,
                         SLOT( 'accept()' ) )

        layout.addWidget( buttons )
    def __init__(self, parent=None):
        super(AddPresetDialog, self).__init__(parent)

        self.setWindowTitle(self.tr("Add IMAP Server Preset"))
        self.resize(388, 125)
        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setGeometry(QRect(184, 80, 181, 32))
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setCenterButtons(False)
        self.save_btn = QPushButton("&Save")
        self.save_btn.setDefault(True)
        self.save_btn.setEnabled(False)
        self.cancel_btn = QPushButton(self.tr("&Cancel"))
        self.cancel_btn.setCheckable(True)
        self.cancel_btn.setAutoDefault(False)

        self.buttonBox.addButton(self.save_btn, QDialogButtonBox.AcceptRole)
        self.buttonBox.addButton(self.cancel_btn, QDialogButtonBox.RejectRole)

        self.preset_name_le = QLineEdit(self)
        self.preset_name_le.setGeometry(QRect(134, 12, 231, 20))
        self.lb_name = QLabel(self)
        self.lb_name.setGeometry(QRect(14, 16, 58, 14))
        self.lb_name.setText(self.tr("Name"))
        self.server_address_le = QLineEdit(self)
        self.server_address_le.setGeometry(QRect(134, 45, 231, 20))
        self.lb_server = QLabel(self)
        self.lb_server.setGeometry(QRect(14, 48, 81, 16))
        self.lb_server.setText(self.tr("IMAP Server"))
        self.lb_info = QLabel(self)
        self.lb_info.setGeometry(QRect(14, 90, 161, 16))
        self.lb_info.setText(self.tr("(SSL is always on.)"))

        self.buttonBox.accepted.connect(self.act_save_preset)
        self.buttonBox.rejected.connect(self.reject)

        self.init_settings()

        self.settings.beginGroup("Server Presets")
        self.presetNameList = []
        for preset in self.settings.allKeys():
            self.presetNameList.append(preset)
        self.settings.endGroup()

        self.preset_name_le.textChanged.connect(self.check_preset_name_availability)
        self.server_address_le.textChanged.connect(self.check_server_address)
Exemple #48
0
    def __init__(self, window, ok_handler, cancel_handler):
        super(ChangePasswordDialog, self).__init__(window)
        self.setWindowTitle("Change password")
        self.setFixedSize(300, 160)
        self.setModal(True)

        self.layout = QGridLayout(self)

        self.old_password_label = QLabel(self)
        self.old_password_label.setText("Old password")
        self.edit_old_password = QLineEdit(self)
        self.edit_old_password.setEchoMode(QLineEdit.Password)

        self.password_label = QLabel(self)
        self.password_label.setText("New password")
        self.edit_password = QLineEdit(self)
        self.edit_password.setEchoMode(QLineEdit.Password)

        self.confirm_label = QLabel(self)
        self.confirm_label.setText("Confirm password")
        self.edit_confirm = QLineEdit(self)
        self.edit_confirm.setEchoMode(QLineEdit.Password)

        self.buttons = QDialogButtonBox(self)
        self.buttons.addButton(QDialogButtonBox.Ok)
        self.buttons.addButton(QDialogButtonBox.Cancel)
        self.buttons.button(QDialogButtonBox.Ok).setText("Change")
        self.buttons.button(QDialogButtonBox.Cancel).setText("Cancel")
        self.buttons.button(QDialogButtonBox.Cancel).clicked.connect(cancel_handler)

        self.buttons.button(QDialogButtonBox.Ok).clicked.connect(
            lambda: ok_handler(self.edit_old_password.text(), self.edit_password.text(), self.edit_confirm.text()))

        self.layout.addWidget(self.old_password_label, 0, 0)
        self.layout.addWidget(self.edit_old_password, 0, 1)
        self.layout.addWidget(self.password_label, 1, 0)
        self.layout.addWidget(self.edit_password, 1, 1)
        self.layout.addWidget(self.confirm_label, 2, 0)
        self.layout.addWidget(self.edit_confirm, 2, 1)
        self.layout.addWidget(self.buttons, 3, 0, 1, 2, Qt.AlignCenter)

        self.setLayout(self.layout)
Exemple #49
0
    def __init__(self, parent = None):
        if not parent:
            parent = hiero.ui.mainWindow()
        super(ExportPdfOptionDialog, self).__init__(parent)

        layout = QFormLayout()
        self._fileNameField  = FnFilenameField(False, isSaveFile=False, caption="Set PDF name", filter='*.pdf')
        self._fileNameField.setFilename(os.path.join(os.getenv('HOME'), "Desktop", "Sequence.pdf"))
        self._pdfLayoutDropdown  = QComboBox()
        self._pdfLayoutDropdown.setToolTip("Set the PDF page layout type.")
        self._thumbFrameTypeDropdown  = QComboBox()
        self._thumbFrameTypeDropdown.setToolTip("Set which frame to take the thumbnail from.")

        self._buttonbox = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        self._buttonbox.button(QDialogButtonBox.Ok).setText("Export")
        self._buttonbox.accepted.connect(self.accept)
        self._buttonbox.rejected.connect(self.reject)

        self._pdfLayouts = PDFExporter.PAGE_LAYOUTS_DICT

        self._thumbFrameTypes = PDFExporter.THUMB_FRAME_TYPES

        for pdfLayout in sorted(self._pdfLayouts, reverse=True):
            self._pdfLayoutDropdown.addItem(pdfLayout)

        for frameType in self._thumbFrameTypes:
            self._thumbFrameTypeDropdown.addItem(frameType)

        layout.addRow("Save to:", self._fileNameField)
        layout.addRow("PDF Layout:", self._pdfLayoutDropdown)
        layout.addRow("Thumbnail Frame:", self._thumbFrameTypeDropdown)        
        layout.addRow("", self._buttonbox)

        self.setLayout(layout)
        self.setWindowTitle("Export PDF Options")
        self.setSizePolicy( QSizePolicy.Expanding, QSizePolicy.Fixed )
Exemple #50
0
 def setup(self):
     
     self.dirty = False
     
     self.def_cfg = copy.deepcopy(self.config)
     self.config.update_from_user_file()
     self.base_cfg = copy.deepcopy(self.config)
     
     self.categories = QListWidget()
     #self.categories.setSizePolicy(QSizePolicy.Fixed,QSizePolicy.Expanding)
     self.settings = QStackedWidget()
     #self.categories.setSizePolicy(QSizePolicy.MinimumExpanding,QSizePolicy.Expanding)
     
     QObject.connect(self.categories, SIGNAL('itemSelectionChanged()'), self.category_selected)
     
     self.widget_list = {}
     for cat in self.config.get_categories():
         self.widget_list[cat] = {}
     longest_cat = 0
     for cat in self.config.get_categories():
         if len(cat) > longest_cat:
             longest_cat = len(cat)
         self.categories.addItem(cat)
         settings_layout = QGridLayout()
         r = 0
         c = 0
         for setting in self.config.get_settings(cat):
             info = self.config.get_setting(cat, setting, True)
             s = QWidget()
             s.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Fixed)
             sl = QVBoxLayout()
             label = QLabel()
             if info.has_key('alias'):
                 label.setText(info['alias'])
             else:
                 label.setText(setting)
             if info.has_key('about'):
                 label.setToolTip(info['about'])
             sl.addWidget(label)
             if info['type'] == constants.CT_LINEEDIT:
                 w = LineEdit(self, self.config,cat,setting,info)
             elif info['type'] == constants.CT_CHECKBOX:
                 w = CheckBox(self, self.config,cat,setting,info)
             elif info['type'] == constants.CT_SPINBOX:
                 w = SpinBox(self, self.config,cat,setting,info)
             elif info['type'] == constants.CT_DBLSPINBOX:
                 w = DoubleSpinBox(self, self.config,cat,setting,info)
             elif info['type'] == constants.CT_COMBO:
                 w = ComboBox(self, self.config,cat,setting,info)
             w.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Fixed)
             self.widget_list[cat][setting] = w
             sl.addWidget(w)
             s.setLayout(sl)
             c = self.config.config[cat].index(setting) % 2
             settings_layout.addWidget(s, r, c)
             if c == 1:
                 r += 1
         settings = QWidget()
         settings.setLayout(settings_layout)
         settings_scroller = QScrollArea()
         settings_scroller.setWidget(settings)
         settings_scroller.setWidgetResizable(True)
         self.settings.addWidget(settings_scroller)
         
     font = self.categories.font()
     fm = QFontMetrics(font)
     self.categories.setMaximumWidth(fm.widthChar('X')*(longest_cat+4))
     
     self.main = QWidget()
     self.main_layout = QVBoxLayout()
     
     self.config_layout = QHBoxLayout()
     self.config_layout.addWidget(self.categories)
     self.config_layout.addWidget(self.settings)
     
     self.mainButtons = QDialogButtonBox(QDialogButtonBox.RestoreDefaults | QDialogButtonBox.Reset | QDialogButtonBox.Apply)
     self.main_apply = self.mainButtons.button(QDialogButtonBox.StandardButton.Apply)
     self.main_reset = self.mainButtons.button(QDialogButtonBox.StandardButton.Reset)
     self.main_defaults = self.mainButtons.button(QDialogButtonBox.StandardButton.LastButton)
     QObject.connect(self.mainButtons, SIGNAL('clicked(QAbstractButton *)'), self.mainbutton_clicked)
     
     self.dirty_check()
     
     self.main_layout.addLayout(self.config_layout)
     self.main_layout.addWidget(self.mainButtons)
     
     self.main.setLayout(self.main_layout)
     
     self.setCentralWidget(self.main)
     self.setWindowTitle(self.title)
     self.setUnifiedTitleAndToolBarOnMac(True)
     
     self.categories.setCurrentItem(self.categories.item(0))
     
     self.menuBar = QMenuBar()
     self.filemenu = QMenu('&File')
     self.quitAction = QAction(self)
     self.quitAction.setText('&Quit')
     if platform.system() != 'Darwin':
         self.quitAction.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_Q))
     QObject.connect(self.quitAction, SIGNAL('triggered()'), self.quitApp)
     self.filemenu.addAction(self.quitAction)
     self.menuBar.addMenu(self.filemenu)
     self.setMenuBar(self.menuBar)
     
     self.show()
     self.activateWindow()
     self.raise_()
     
     self.setMinimumWidth(self.geometry().width()*1.2)
     
     screen = QDesktopWidget().screenGeometry()
     size = self.geometry()
     self.move((screen.width()-size.width())/2, (screen.height()-size.height())/2)
Exemple #51
0
class ConfigEditor(QMainWindow):
    
    def __init__(self, app, cfg, title='Config Editor'):
        super(ConfigEditor, self).__init__()
        
        self.app = app
        self.config = cfg
        self.title = title
        
    def setup(self):
        
        self.dirty = False
        
        self.def_cfg = copy.deepcopy(self.config)
        self.config.update_from_user_file()
        self.base_cfg = copy.deepcopy(self.config)
        
        self.categories = QListWidget()
        #self.categories.setSizePolicy(QSizePolicy.Fixed,QSizePolicy.Expanding)
        self.settings = QStackedWidget()
        #self.categories.setSizePolicy(QSizePolicy.MinimumExpanding,QSizePolicy.Expanding)
        
        QObject.connect(self.categories, SIGNAL('itemSelectionChanged()'), self.category_selected)
        
        self.widget_list = {}
        for cat in self.config.get_categories():
            self.widget_list[cat] = {}
        longest_cat = 0
        for cat in self.config.get_categories():
            if len(cat) > longest_cat:
                longest_cat = len(cat)
            self.categories.addItem(cat)
            settings_layout = QGridLayout()
            r = 0
            c = 0
            for setting in self.config.get_settings(cat):
                info = self.config.get_setting(cat, setting, True)
                s = QWidget()
                s.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Fixed)
                sl = QVBoxLayout()
                label = QLabel()
                if info.has_key('alias'):
                    label.setText(info['alias'])
                else:
                    label.setText(setting)
                if info.has_key('about'):
                    label.setToolTip(info['about'])
                sl.addWidget(label)
                if info['type'] == constants.CT_LINEEDIT:
                    w = LineEdit(self, self.config,cat,setting,info)
                elif info['type'] == constants.CT_CHECKBOX:
                    w = CheckBox(self, self.config,cat,setting,info)
                elif info['type'] == constants.CT_SPINBOX:
                    w = SpinBox(self, self.config,cat,setting,info)
                elif info['type'] == constants.CT_DBLSPINBOX:
                    w = DoubleSpinBox(self, self.config,cat,setting,info)
                elif info['type'] == constants.CT_COMBO:
                    w = ComboBox(self, self.config,cat,setting,info)
                w.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Fixed)
                self.widget_list[cat][setting] = w
                sl.addWidget(w)
                s.setLayout(sl)
                c = self.config.config[cat].index(setting) % 2
                settings_layout.addWidget(s, r, c)
                if c == 1:
                    r += 1
            settings = QWidget()
            settings.setLayout(settings_layout)
            settings_scroller = QScrollArea()
            settings_scroller.setWidget(settings)
            settings_scroller.setWidgetResizable(True)
            self.settings.addWidget(settings_scroller)
            
        font = self.categories.font()
        fm = QFontMetrics(font)
        self.categories.setMaximumWidth(fm.widthChar('X')*(longest_cat+4))
        
        self.main = QWidget()
        self.main_layout = QVBoxLayout()
        
        self.config_layout = QHBoxLayout()
        self.config_layout.addWidget(self.categories)
        self.config_layout.addWidget(self.settings)
        
        self.mainButtons = QDialogButtonBox(QDialogButtonBox.RestoreDefaults | QDialogButtonBox.Reset | QDialogButtonBox.Apply)
        self.main_apply = self.mainButtons.button(QDialogButtonBox.StandardButton.Apply)
        self.main_reset = self.mainButtons.button(QDialogButtonBox.StandardButton.Reset)
        self.main_defaults = self.mainButtons.button(QDialogButtonBox.StandardButton.LastButton)
        QObject.connect(self.mainButtons, SIGNAL('clicked(QAbstractButton *)'), self.mainbutton_clicked)
        
        self.dirty_check()
        
        self.main_layout.addLayout(self.config_layout)
        self.main_layout.addWidget(self.mainButtons)
        
        self.main.setLayout(self.main_layout)
        
        self.setCentralWidget(self.main)
        self.setWindowTitle(self.title)
        self.setUnifiedTitleAndToolBarOnMac(True)
        
        self.categories.setCurrentItem(self.categories.item(0))
        
        self.menuBar = QMenuBar()
        self.filemenu = QMenu('&File')
        self.quitAction = QAction(self)
        self.quitAction.setText('&Quit')
        if platform.system() != 'Darwin':
            self.quitAction.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_Q))
        QObject.connect(self.quitAction, SIGNAL('triggered()'), self.quitApp)
        self.filemenu.addAction(self.quitAction)
        self.menuBar.addMenu(self.filemenu)
        self.setMenuBar(self.menuBar)
        
        self.show()
        self.activateWindow()
        self.raise_()
        
        self.setMinimumWidth(self.geometry().width()*1.2)
        
        screen = QDesktopWidget().screenGeometry()
        size = self.geometry()
        self.move((screen.width()-size.width())/2, (screen.height()-size.height())/2)
        
    def category_selected(self):
        self.settings.setCurrentIndex(self.config.config.index(self.categories.selectedItems()[0].text()))
        
    def mainbutton_clicked(self, button):
        if button == self.main_reset:
            for cat in self.base_cfg.get_categories():
                for setting in self.base_cfg.get_settings(cat):
                    self.widget_list[cat][setting].updateValue(self.base_cfg.get_setting(cat,setting))
        elif button == self.main_defaults:
            for cat in self.def_cfg.get_categories():
                for setting in self.def_cfg.get_settings(cat):
                    self.widget_list[cat][setting].updateValue(self.def_cfg.get_setting(cat,setting))
        elif button == self.main_apply:
            bad_settings = self.validate_settings()
            if bad_settings == []:
                self.save_settings()
                self.main_apply.setEnabled(False)
                self.main_reset.setEnabled(False)
            else:
                msgBox = QMessageBox()
                msgBox.setText("Must fix the following invalid settings before quitting:")
                msgBox.setStandardButtons(QMessageBox.Ok)
                info = ''
                for setting in bad_settings:
                    new = '%s,%s<br>' % setting
                    info = '%s%s' % (info, new)
                msgBox.setInformativeText(info)
                msgBox.exec_()
            
        
    def quitApp(self):
        self.app.closeAllWindows()
        
    def get_changes(self):
        enc = MyEncoder()
        if enc.encode(self.def_cfg.config) == enc.encode(self.config.config):
            return False
        if enc.encode(self.base_cfg.config) != enc.encode(self.config.config):
            newC = Config()
            for c in self.config.config.keys():
                for s in self.config.config[c].keys():
                    if self.config.config[c][s]['value'] != self.def_cfg.config[c][s]['value']:
                        newC.add_setting(c, s, self.config.config[c][s]['value'], stub=True)    
            return json.dumps(newC.config, separators=(',',': '), indent=4, sort_keys=True)
        else:
            return None
        
    def validate_settings(self):
        ret = []
        for cat in self.config.get_categories():
            for setting in self.config.get_settings(cat):
                info = self.config.get_setting(cat, setting, True)
                if info.has_key('validate'):
                    if not info['validate'](info):
                        ret.append((cat,setting))
        return ret
    
    def dirty_check(self):
        if str(self.base_cfg) != str(self.config):
            self.dirty = True
            self.main_apply.setEnabled(True)
            self.main_reset.setEnabled(True)
        else:
            self.dirty = False
            self.main_apply.setEnabled(False)
            self.main_reset.setEnabled(False)
        if str(self.def_cfg) == str(self.config):
            self.main_defaults.setEnabled(False)
        else:
            self.main_defaults.setEnabled(True)
            
    def save_settings(self):
        config = self.get_changes()
        if config == False:
            if os.path.isfile(self.config.user_file):
                os.remove(self.config.user_file)
        elif config != None:
            with open(self.config.user_file, 'w+') as f:
                f.write(config)
        self.base_cfg = copy.deepcopy(self.config)
            
    def closeEvent(self, event=None):
        self.quitApp()
class AddPresetDialog(QDialog):
    def __init__(self, parent=None):
        super(AddPresetDialog, self).__init__(parent)

        self.setWindowTitle(self.tr("Add IMAP Server Preset"))
        self.resize(388, 125)
        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setGeometry(QRect(184, 80, 181, 32))
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setCenterButtons(False)
        self.save_btn = QPushButton("&Save")
        self.save_btn.setDefault(True)
        self.save_btn.setEnabled(False)
        self.cancel_btn = QPushButton(self.tr("&Cancel"))
        self.cancel_btn.setCheckable(True)
        self.cancel_btn.setAutoDefault(False)

        self.buttonBox.addButton(self.save_btn, QDialogButtonBox.AcceptRole)
        self.buttonBox.addButton(self.cancel_btn, QDialogButtonBox.RejectRole)

        self.preset_name_le = QLineEdit(self)
        self.preset_name_le.setGeometry(QRect(134, 12, 231, 20))
        self.lb_name = QLabel(self)
        self.lb_name.setGeometry(QRect(14, 16, 58, 14))
        self.lb_name.setText(self.tr("Name"))
        self.server_address_le = QLineEdit(self)
        self.server_address_le.setGeometry(QRect(134, 45, 231, 20))
        self.lb_server = QLabel(self)
        self.lb_server.setGeometry(QRect(14, 48, 81, 16))
        self.lb_server.setText(self.tr("IMAP Server"))
        self.lb_info = QLabel(self)
        self.lb_info.setGeometry(QRect(14, 90, 161, 16))
        self.lb_info.setText(self.tr("(SSL is always on.)"))

        self.buttonBox.accepted.connect(self.act_save_preset)
        self.buttonBox.rejected.connect(self.reject)

        self.init_settings()

        self.settings.beginGroup("Server Presets")
        self.presetNameList = []
        for preset in self.settings.allKeys():
            self.presetNameList.append(preset)
        self.settings.endGroup()

        self.preset_name_le.textChanged.connect(self.check_preset_name_availability)
        self.server_address_le.textChanged.connect(self.check_server_address)

    # ---------------------------------------------------------------------
    def init_settings(self):
        QCoreApplication.setOrganizationName("erdinc.me")
        QCoreApplication.setOrganizationDomain("erdinc.me")
        QCoreApplication.setApplicationName("IMAPLinkParser")
        self.settings = QSettings()
        # self.settings.clear()

    # ---------------------------------------------------------------------
    @Slot()
    def act_save_preset(self):
        try:
            self.settings.beginGroup("Server Presets")
            self.settings.setValue(self.preset_name_le.text(), self.server_address_le.text())
            self.settings.endGroup()
        except:
            self.reject()
        self.accept()

    # ---------------------------------------------------------------------
    @Slot(unicode)
    def check_preset_name_availability(self, text):
        if text in self.presetNameList:
            self.save_btn.setEnabled(False)
            self.lb_info.setText('<p style="color:red;">Preset name exists!')
        else:
            if self.server_address_le.text() and self.preset_name_le.text():
                self.save_btn.setEnabled(True)
                self.lb_info.setText(self.tr("(SSL is always on.)"))
            else:
                self.save_btn.setEnabled(False)
                self.lb_info.setText(self.tr("(SSL is always on.)"))

    # ---------------------------------------------------------------------
    @Slot(unicode)
    def check_server_address(self):
        if self.server_address_le.text():
            preset = self.preset_name_le.text()
            if preset and preset not in self.presetNameList:
                self.save_btn.setEnabled(True)
        else:
            self.save_btn.setEnabled(False)
Exemple #53
0
class Dialog(QDialog):
    def __init__(self):
        super(Dialog, self).__init__()
        
        self.rotableWidgets = []
        
        self.createRotableGroupBox()
        self.createOptionsGroupBox()
        self.createButtonBox()

        mainLayout = QGridLayout()
        mainLayout.addWidget(self.rotableGroupBox, 0, 0)
        mainLayout.addWidget(self.optionsGroupBox, 1, 0)
        mainLayout.addWidget(self.buttonBox, 2, 0)
        mainLayout.setSizeConstraint(QLayout.SetMinimumSize)

        self.mainLayout = mainLayout
        self.setLayout(self.mainLayout)

        self.setWindowTitle("Dynamic Layouts")

    def rotateWidgets(self):
        count = len(self.rotableWidgets)
        if count % 2 == 1:
            raise AssertionError("Number of widgets must be even")
        
        for widget in self.rotableWidgets:
            self.rotableLayout.removeWidget(widget)

        self.rotableWidgets.append(self.rotableWidgets.pop(0))
        
        for i in range(count//2):
            self.rotableLayout.addWidget(self.rotableWidgets[count - i - 1], 0, i)
            self.rotableLayout.addWidget(self.rotableWidgets[i], 1, i)

        
    def buttonsOrientationChanged(self, index):
        self.mainLayout.setSizeConstraint(QLayout.SetNoConstraint);
        self.setMinimumSize(0, 0);

        orientation = Qt.Orientation(int(self.buttonsOrientationComboBox.itemData(index)))

        if orientation == self.buttonBox.orientation():
            return

        self.mainLayout.removeWidget(self.buttonBox);

        spacing = self.mainLayout.spacing()

        oldSizeHint = self.buttonBox.sizeHint() + QSize(spacing, spacing);
        self.buttonBox.setOrientation(orientation)
        newSizeHint = self.buttonBox.sizeHint() + QSize(spacing, spacing)

        if orientation == Qt.Horizontal:
            self.mainLayout.addWidget(self.buttonBox, 2, 0);
            self.resize(self.size() + QSize(-oldSizeHint.width(), newSizeHint.height()))
        else:
            self.mainLayout.addWidget(self.buttonBox, 0, 3, 2, 1);
            self.resize(self.size() + QSize(newSizeHint.width(), -oldSizeHint.height()))

        self.mainLayout.setSizeConstraint(QLayout.SetDefaultConstraint)

    def show_help(self):
        QMessageBox.information(self, "Dynamic Layouts Help",
                            "This example shows how to change layouts "
                            "dynamically.")

    def createRotableGroupBox(self):
        self.rotableGroupBox = QGroupBox("Rotable Widgets")
        
        self.rotableWidgets.append(QSpinBox())
        self.rotableWidgets.append(QSlider())
        self.rotableWidgets.append(QDial())
        self.rotableWidgets.append(QProgressBar())
        count = len(self.rotableWidgets)
        for i in range(count):
            self.rotableWidgets[i].valueChanged[int].\
                connect(self.rotableWidgets[(i+1) % count].setValue)

        self.rotableLayout = QGridLayout()    
        self.rotableGroupBox.setLayout(self.rotableLayout)

        self.rotateWidgets()
                    
    def createOptionsGroupBox(self):
        self.optionsGroupBox = QGroupBox("Options")

        buttonsOrientationLabel = QLabel("Orientation of buttons:")

        buttonsOrientationComboBox = QComboBox()
        buttonsOrientationComboBox.addItem("Horizontal", Qt.Horizontal)
        buttonsOrientationComboBox.addItem("Vertical", Qt.Vertical)
        buttonsOrientationComboBox.currentIndexChanged[int].connect(self.buttonsOrientationChanged)

        self.buttonsOrientationComboBox = buttonsOrientationComboBox

        optionsLayout = QGridLayout()
        optionsLayout.addWidget(buttonsOrientationLabel, 0, 0)
        optionsLayout.addWidget(self.buttonsOrientationComboBox, 0, 1)
        optionsLayout.setColumnStretch(2, 1)
        self.optionsGroupBox.setLayout(optionsLayout)
    
    def createButtonBox(self):
        self.buttonBox = QDialogButtonBox()

        closeButton = self.buttonBox.addButton(QDialogButtonBox.Close)
        helpButton = self.buttonBox.addButton(QDialogButtonBox.Help)
        rotateWidgetsButton = self.buttonBox.addButton("Rotate &Widgets", QDialogButtonBox.ActionRole)

        rotateWidgetsButton.clicked.connect(self.rotateWidgets)
        closeButton.clicked.connect(self.close)
        helpButton.clicked.connect(self.show_help)
    def __init__(self, parent=None):
        """Default class constructor."""
        super(AboutDialog, self).__init__(parent)

        p = self.palette()
        p.setColor(self.backgroundRole(), Qt.white)
        self.setPalette(p)

        if parent:
            self.gImgDir = parent.gImgDir
            self.gIconDir = parent.gIconDir
        elif __name__ == '__main__':
            self.gImgDir = gAppDir + os.sep + 'images'
            self.gIconDir = gAppDir + os.sep + 'icons' + os.sep + 'default'

        # The tiled theme background texture.
        self.bgLogo = QPixmap(self.gImgDir + os.sep + 'texture-spirals.png')
        self.bgBrush = QBrush(self.bgLogo)
        self.setWhatsThis(self.tr("""\
The background is a tiled image of an actual design that was stitched out during the pre-alpha stage.
It was created by Nina Paley and Theodore Gray using Mathematica in conjunction with our software.
They have graciously allowed us to use it for the project in whichever way we wish.
We thought it looked so good, that it has become the new theme for Embroidermodder 2.
To check out some of the more interesting embroidery projects they are working on,
visit http://blog.ninapaley.com/"""))

        self.imgLbl = EmbroidermodderLogo(self)

        aboutLbl = QTextBrowser(self)
        aboutLbl.setReadOnly(True)
        aboutLbl.setOpenExternalLinks(True)
        aboutLbl.setText('<b>%s</b>' % '<br>'.join(__doc__.split('\n')))
        aboutLbl.setWhatsThis(self.tr('This is the AWESOME people that brought Embroidermodder 2 to life.'))

        # We want very slight opacity of the white background
        # so the seamless texture shows slightly through.
        opacityStyleSheet = """\
        QTextEdit:read-only {
            color: rgb(50, 50, 50);
            font-size: 12px;
            font-weight: bold;
            background-color: rgba(255, 255, 255, 240);
            border: 1px solid rgba(0, 0, 0, 255);
            }
            """

        aboutLbl.setStyleSheet(opacityStyleSheet)
        op = QGraphicsOpacityEffect(aboutLbl)
        op.setOpacity(0.95)
        aboutLbl.setGraphicsEffect(op)

        self.notebook = QTabWidget(self)
        self.notebook.setMinimumWidth(500)
        self.notebook.addTab(aboutLbl, self.tr('About'))
        self.notebook.setTabIcon(0, QIcon(self.gIconDir + os.sep + 'app.png'))
        self.notebook.setTabIcon(1, QIcon(self.gImgDir + os.sep + 'kickstarter-logo-k-color.png'))

        notebookStyleSheet = """\
            QTabWidget::pane { /* The tab widget frame */
                border-top: 1px solid #000000;
                position: absolute;
                top: -0.5em;
            }

            QTabWidget::tab-bar {
                alignment: center;
            }

            /* Style the tab using the tab sub-control. Note that
                it reads QTabBar _not_ QTabWidget */
            QTabBar::tab {
                margin-top: 2px; /* make non-selected tabs look smaller */
                font-size: 14px;
                font-weight: bold;
                background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
                                            stop: 0 #E1E1E1, stop: 0.4 #DDDDDD,
                                            stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);
                border: 1px solid #000000;
                /* border-bottom-color: #C2C7CB; */ /* same as the pane color */
                border-top-left-radius: 4px;
                border-top-right-radius: 4px;
                min-width: 40ex;
                min-height: 5ex;
                padding: 3px;
            }

            QTabBar::tab:selected {
                margin-top: 0px;
                font-size: 16px;
                font-weight: bold;
                background: qlineargradient(x1: 0, y1: 0, x2: 2, y2: 2,
                                            stop: 0 #0C6AB0, stop: 0.15 #55C4E6,
                                            stop: 0.15 #55C4E6, stop: 0.5 #FFFFFF,
                                            stop: 0.5 #FFFFFF, stop: 0.85 #55C4E6,
                                            stop: 0.85 #55C4E6, stop: 1.0 #0C6AB0);
                border: 1px solid #000000;
            }

            QTabBar::tab:!selected:hover {
                margin-top: 2px; /* make non-selected tabs look smaller */
                font-size: 14px;
                font-weight: bold;
                background: qlineargradient(x1: 0, y1: 0, x2: 2, y2: 2,
                                            stop: 0 #888888, stop: 0.15 #BBBBBB,
                                            stop: 0.15 #BBBBBB, stop: 0.5 #FFFFFF,
                                            stop: 0.5 #FFFFFF, stop: 0.85 #BBBBBB,
                                            stop: 0.85 #BBBBBB, stop: 1.0 #888888);
                border: 1px solid #000000;
            }

            QTabBar::tab:selected {
                border-color: #000000;
                border-bottom-color: #000000; /* same as pane color */
            }
            """

        self.notebook.setStyleSheet(notebookStyleSheet)
        self.notebook.currentChanged.connect(self.CurrentTabChanged)

        buttonbox = QDialogButtonBox(Qt.Horizontal, self)
        button = QPushButton(self)
        button.setText(self.tr("Oh, Yeah!"))
        button.setWhatsThis(self.tr('This is the Oh, Yeah! button!') + '\n' + self.tr('Oh, Yeah!'))
        buttonbox.addButton(button, QDialogButtonBox.AcceptRole)
        buttonbox.setCenterButtons(True)
        buttonbox.accepted.connect(self.accept)

        hbLayout1 = QHBoxLayout()
        hbLayout2 = QHBoxLayout()
        vbLayout = QVBoxLayout()
        hbLayout1.addStretch()
        hbLayout1.addWidget(self.imgLbl)
        hbLayout1.addStretch()
        hbLayout2.addStretch()
        hbLayout2.addWidget(self.notebook)
        hbLayout2.addStretch()
        vbLayout.addLayout(hbLayout1)
        vbLayout.addLayout(hbLayout2)
        vbLayout.addWidget(buttonbox)
        self.setLayout(vbLayout)

        self.setWindowTitle(self.tr('About Embroidermodder Version 2.0'))

        QApplication.restoreOverrideCursor() # TODO/???/PORT# don't mess with the window resize cursors.
Exemple #55
0
    def _create_buttons ( self, parent ):
        buttons = QDialogButtonBox()

        # 'OK' button.
        # FIXME v3: Review how this is supposed to work for non-modal dialogs
        # (ie. how does anything act on a button click?)
        if self.ok_label:
            btn = buttons.addButton( self.ok_label,
                                     QDialogButtonBox.AcceptRole )
        else:
            btn = buttons.addButton( QDialogButtonBox.Ok )

        btn.setDefault( True )

        # 'Cancel' button.
        # FIXME v3: Review how this is supposed to work for non-modal dialogs
        # (ie. how does anything act on a button click?)
        if self.cancel_label:
            buttons.addButton( self.cancel_label, QDialogButtonBox.RejectRole )
        else:
            buttons.addButton( QDialogButtonBox.Cancel )

        # 'Help' button.
        # FIXME v3: In the original code the only possible hook into the help
        # was to reimplement self._on_help().  However this was a private
        # method.  Obviously nobody uses the Help button.  For the moment we
        # display it but can't actually use it.
        if len( self.help_id ) > 0:
            if self.help_label:
                buttons.addButton( self.help_label, QDialogButtonBox.HelpRole )
            else:
                buttons.addButton( QDialogButtonBox.Help )

        return buttons
class Dialog(QDialog):
    def __init__(self):
        super(Dialog, self).__init__()

        self.osc = OSCSender()

        self.createPreControlBox()
        self.createPlayControlBox()
        self.createButtonBox()

        mainLayout = QGridLayout()
        mainLayout.addWidget(self.preControlBox, 0, 0)
        mainLayout.addWidget(self.playControlBox, 1, 0)
        mainLayout.addWidget(self.buttonBox, 2, 0)
        mainLayout.setSizeConstraint(QLayout.SetMinimumSize)

        self.mainLayout = mainLayout
        self.setLayout(self.mainLayout)

        self.setWindowTitle("Confidence Man")

    def createButtonBox(self):
        self.buttonBox = QDialogButtonBox()

        closeButton = self.buttonBox.addButton(QDialogButtonBox.Close)
        helpButton = self.buttonBox.addButton(QDialogButtonBox.Help)
        closeButton.clicked.connect(self.close)
        helpButton.clicked.connect(self.show_help)

    def createPlayControlBox(self):
        self.playControlBox = QGroupBox("Player Controls")
        playControlLayout = QHBoxLayout()

        playButton = QPushButton("Play")
        playButton.clicked.connect(self.playClicked)
        playControlLayout.addWidget(playButton)

        pauseButton = QPushButton("Pause")
        pauseButton.clicked.connect(self.pauseClicked)
        playControlLayout.addWidget(pauseButton)

        resumeButton = QPushButton("Resume")
        resumeButton.clicked.connect(self.resumeClicked)
        playControlLayout.addWidget(resumeButton)

        self.playControlBox.setLayout(playControlLayout)

    def createPreControlBox(self):
        self.preControlBox = QGroupBox("Pre-Show Controls")
        preControlLayout = QHBoxLayout()

        resetButton = QPushButton("Reset")
        resetButton.clicked.connect(self.resetClicked)
        preControlLayout.addWidget(resetButton)

        # TODO - make togglePushButton.setCheckable(True)
        prepareButton = QPushButton("Prepare")
        prepareButton.clicked.connect(self.prepareClicked)
        preControlLayout.addWidget(prepareButton)

        bgButton = QPushButton("Background")
        bgButton.clicked.connect(self.bgClicked)
        preControlLayout.addWidget(bgButton)

        self.preControlBox.setLayout(preControlLayout)

    def playClicked(self):
        logger.debug("Play clicked")
        self.osc.start()

    def pauseClicked(self):
        logger.debug("Pause clicked")
        self.osc.pause()

    def resumeClicked(self):
        logger.debug("Resume clicked")
        self.osc.resume()

    def resetClicked(self):
        logger.debug("Reset clicked")
        self.osc.reset()

    def prepareClicked(self):
        logger.debug("Prepare clicked")
        self.osc.prepare()

    def bgClicked(self):
        logger.debug("Background clicked")
        self.osc.bg()

    def show_help(self):
        QMessageBox.information(self, "Confidence Man Help",
                            "Help yourself.")
Exemple #57
0
class ExportPdfOptionDialog(QDialog):
    """
    Displays options UI for the PDF
    """

    def __init__(self, parent = None):
        if not parent:
            parent = hiero.ui.mainWindow()
        super(ExportPdfOptionDialog, self).__init__(parent)

        layout = QFormLayout()
        self._fileNameField  = FnFilenameField(False, isSaveFile=False, caption="Set PDF name", filter='*.pdf')
        self._fileNameField.setFilename(os.path.join(os.getenv('HOME'), "Desktop", "Sequence.pdf"))
        self._pdfLayoutDropdown  = QComboBox()
        self._pdfLayoutDropdown.setToolTip("Set the PDF page layout type.")
        self._thumbFrameTypeDropdown  = QComboBox()
        self._thumbFrameTypeDropdown.setToolTip("Set which frame to take the thumbnail from.")

        self._buttonbox = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        self._buttonbox.button(QDialogButtonBox.Ok).setText("Export")
        self._buttonbox.accepted.connect(self.accept)
        self._buttonbox.rejected.connect(self.reject)

        self._pdfLayouts = PDFExporter.PAGE_LAYOUTS_DICT

        self._thumbFrameTypes = PDFExporter.THUMB_FRAME_TYPES

        for pdfLayout in sorted(self._pdfLayouts, reverse=True):
            self._pdfLayoutDropdown.addItem(pdfLayout)

        for frameType in self._thumbFrameTypes:
            self._thumbFrameTypeDropdown.addItem(frameType)

        layout.addRow("Save to:", self._fileNameField)
        layout.addRow("PDF Layout:", self._pdfLayoutDropdown)
        layout.addRow("Thumbnail Frame:", self._thumbFrameTypeDropdown)        
        layout.addRow("", self._buttonbox)

        self.setLayout(layout)
        self.setWindowTitle("Export PDF Options")
        self.setSizePolicy( QSizePolicy.Expanding, QSizePolicy.Fixed )

    def _thumbnailFrameType(self):
        """Returns the currently selected thumbnail frame type"""
        return self._thumbFrameTypeDropdown.currentText()

    def _numRows(self):
        """Returns the number of rows for the pdf"""
        optionText = self._pdfLayoutDropdown.currentText()
        return self._pdfLayouts[optionText][0]

    def _numColumns(self):
        """Returns the number of columns for the pdf"""
        optionText = self._pdfLayoutDropdown.currentText()
        return self._pdfLayouts[optionText][1]

    def _filePath(self):
        """Returns the filepath for the pdf"""
        filename = self._fileNameField.filename()
        if not filename.endswith('.pdf'):
            filename = filename + ".pdf"
        return filename
    def __init__(self, parent=None):
        super(AddAccountDialog, self).__init__(parent)
        # self.setAttribute(Qt.WA_DeleteOnClose)

        lbMinWidth = 150
        leMinWidth = 200

        self.isMatch = False

        # self.keyDialog.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.setWindowTitle("Create a new account preset")

        baseLayout = QVBoxLayout(self)
        nameLayout = QHBoxLayout()
        keyLayout = QHBoxLayout()
        keyConfirmLayout = QHBoxLayout()

        baseLayout.addLayout(nameLayout)
        baseLayout.addLayout(keyLayout)
        baseLayout.addLayout(keyConfirmLayout)

        lb_name = QLabel('Account Preset Name: ', self)
        lb_name.setMinimumWidth(lbMinWidth)
        self.name_le = QLineEdit(self)
        self.name_le.setMinimumWidth(leMinWidth)
        nameLayout.addWidget(lb_name)
        nameLayout.addWidget(self.name_le)

        lb_key = QLabel('Encryption Key: ', self)
        lb_key.setMinimumWidth(lbMinWidth)
        self.key_le = QLineEdit(self)
        # self.key_le.setPlaceholderText('Encryption Key')
        self.key_le.setEchoMode(self.key_le.Password)
        self.key_le.setMinimumWidth(leMinWidth)
        keyLayout.addWidget(lb_key)
        keyLayout.addWidget(self.key_le)

        lb_keyConfirm = QLabel('Confirm Key: ', self)
        lb_keyConfirm.setMinimumWidth(lbMinWidth)
        self.keyConfirm_le = QLineEdit(self)
        # self.keyConfirm_le.setPlaceholderText('Encryption Key')
        self.keyConfirm_le.setEchoMode(self.key_le.Password)
        self.keyConfirm_le.setMinimumWidth(leMinWidth)
        keyConfirmLayout.addWidget(lb_keyConfirm)
        keyConfirmLayout.addWidget(self.keyConfirm_le)

        self.okBtn = QPushButton(self.tr("&Ok"))
        self.okBtn.setDefault(True)
        self.okBtn.setEnabled(False)

        cancelBtn = QPushButton(self.tr("&Cancel"))
        cancelBtn.setAutoDefault(False)

        buttonBox = QDialogButtonBox(Qt.Horizontal, self)
        buttonBox.addButton(self.okBtn, QDialogButtonBox.AcceptRole)
        buttonBox.addButton(cancelBtn, QDialogButtonBox.RejectRole)

        baseLayout.addWidget(buttonBox)

        self.name_le.textChanged.connect(self.name_confirmator)
        self.key_le.textChanged.connect(self.key_confirmator)
        self.keyConfirm_le.textChanged.connect(self.key_confirmator)

        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)
Exemple #59
0
	def __init__(self, parent=None):
		super(optdlg, self).__init__(parent)
		self.setFixedSize(484, 399)
		appicom = QIcon(":/icons/njnlogo.png")
		self.setWindowIcon(appicom)
		self.setWindowTitle("Nigandu English to Tamil Dictionary | OPTIONS")

		self.buttonBox = QDialogButtonBox(self)
		self.buttonBox.setEnabled(True)
		self.buttonBox.setGeometry(QRect(350, 20, 121, 200))

		self.buttonBox.setOrientation(Qt.Vertical)
		self.buttonBox.setStandardButtons(QDialogButtonBox.Apply|QDialogButtonBox.Cancel|QDialogButtonBox.Ok)
		self.buttonBox.setCenterButtons(True)
		self.restorebtn = QPushButton(self)
		self.restorebtn.setGeometry(QRect(354, 360, 121, 23))
		self.restorebtn.setText("&RestoreDefults")

		self.fontbox = QGroupBox(self)
		self.fontbox.setGeometry(QRect(10, 10, 331, 141))
		self.spinBox = QSpinBox(self.fontbox)
		self.spinBox.setGeometry(QRect(100, 20, 81, 21))
		self.spinBox.setMinimum(10)
		self.spinBox.setMaximum(24)
		self.label = QLabel(self.fontbox)
		self.label.setGeometry(QRect(20, 20, 71, 21))
		self.label.setText("Font Size:")
		self.fontbox.setTitle("Font")
		self.samplefontbox = QGroupBox(self)
		self.samplefontbox.setGeometry(QRect(20, 50, 291, 91))
		self.samplefontbox.setTitle("Sample Text")
		self.sampletxt = QLabel(self.samplefontbox)
		self.sampletxt.setGeometry(QRect(20, 20, 251, 61))
		self.sampletxt.setText("AaBbCcDdEeFfGgHhIiJjKkLlYyZz")

		self.clipbox = QGroupBox(self)
		self.clipbox.setGeometry(QRect(10, 160, 331, 61))
		self.clipbox.setTitle("ClipBoard Options")
		self.checkclip = QCheckBox(self.clipbox)
		self.checkclip.setGeometry(QRect(20, 20, 301, 31))
		self.checkclip.setText("Allow copy from clipboard on start-up")


		self.histbox = QGroupBox(self)
		self.histbox.setGeometry(QRect(10, 230, 331, 91))
		self.histbox.setTitle("History")
		self.checkshowhistdock = QCheckBox(self.histbox)
		self.checkshowhistdock.setGeometry(QRect(20, 60, 301, 17))

		self.checkshowhistdock.setText("Show History Dock on the right side")
		self.checkdelhist = QCheckBox(self.histbox)
		self.checkdelhist.setGeometry(QRect(20, 30, 301, 17))
		self.checkdelhist.setText("Clear all the past history records")

		self.bkmbox = QGroupBox(self)
		self.bkmbox.setGeometry(QRect(10, 330, 331, 61))
		self.bkmbox.setTitle("Book Marks")
		self.checkshowbkmdock = QCheckBox(self.bkmbox)
		self.checkshowbkmdock.setGeometry(QRect(20, 30, 301, 17))
		self.checkshowbkmdock.setText("Show Book Marks Dock on the right side.")

		self.spinBox.valueChanged[int].connect(self.setsampletxt)
		self.restorebtn.clicked.connect(self.setdeafults)
		self.buttonBox.rejected.connect(self.close)
Exemple #60
0
    def __init__(self, parent=None):
        QMainWindow.__init__(self, parent)

        # Destroying the C++ object right after closing the dialog box,
        # otherwise it may be garbage-collected in another QThread
        # (e.g. the editor's analysis thread in Spyder), thus leading to
        # a segmentation fault on UNIX or an application crash on Windows
        self.setAttribute(Qt.WA_DeleteOnClose)

        self.statusBar().showMessage('Ready')

        self.saveButton = QPushButton(self.tr("Save"))
        self.saveButton.setDefault(True)
        self.quitButton = QPushButton(self.tr("Quit"))
        self.quitButton.setAutoDefault(False)
        buttonBox = QDialogButtonBox()
        buttonBox.addButton(self.saveButton,
                            QDialogButtonBox.ActionRole)
        buttonBox.addButton(self.quitButton, QDialogButtonBox.RejectRole)
        self.connect(self.saveButton, SIGNAL('clicked()'), self.save_file)
        self.connect(self.quitButton, SIGNAL('clicked()'), self.close)

        """
        bbox = QDialogButtonBox(QDialogButtonBox.Apply
                                |QDialogButtonBox.Cancel)
        self.apply_btn = bbox.button(QDialogButtonBox.Apply)
        self.connect(bbox, SIGNAL("accepted()"), SLOT("accept()"))
        self.connect(bbox, SIGNAL("rejected()"), SLOT("reject()"))
        self.connect(bbox, SIGNAL("clicked(QAbstractButton*)"),
                     self.button_clicked)
        """
        self.lineedits = {}
        self.comboboxes = {}
        self.spinboxes = {}
        self.availability_label = None

        self.job_name_widget = self.create_lineedit('Job Name', 'job_name')
        self.job_script_widget = self.create_lineedit('Job Script',
                                                      'job_script')
        self.job_output_widget = self.create_lineedit('Job Output',
                                                      'job_output')
        self.project_name_widget = self.create_lineedit('Project/Account',
                                                        'project_name')
        self.queue_widget = self.create_combobox('Queue', [], 'queues')
        self.availability_label = QLabel('Available:')
        self.num_tasks_widget = self.create_spinbox('Number tasks',
                                                    '', 'ntasks',
                                                    NoDefault, 1, 1, 1,
                                                    'total number of tasks')
        self.task_per_node_widget = self.create_spinbox('Task per node',
                                                        '', 'task_per_node',
                                                        NoDefault, 1, 2, 1,
                                                        'tasks per node')
        self.runtime_widget = self.create_spinbox('Runtime', 'hrs', 'runtime',
                                                  NoDefault, 1, 36, 1,
                                                  'runtime in hrs')
        self.app_script_widget = self.create_combobox('Application Script',
                                                    [('mycluster-zcfd.bsh','mycluster-zcfd.bsh'),
                                                     ('mycluster-paraview.bsh','mycluster-paraview.bsh'),
                                                     ('mycluster-fluent.bsh','mycluster-fluent.bsh')],
                                                    'app_script')

        # hsplitter = QSplitter()
        # hsplitter.addWidget(self.pages_widget)

        btnlayout = QHBoxLayout()
        btnlayout.addStretch(1)
        btnlayout.addWidget(buttonBox)

        vlayout = QVBoxLayout()
        # vlayout.addWidget(hsplitter)

        vlayout.addWidget(self.job_name_widget)
        vlayout.addWidget(self.job_script_widget)
        vlayout.addWidget(self.job_output_widget)
        vlayout.addWidget(self.project_name_widget)
        hlayout = QHBoxLayout()
        hlayout.addWidget(self.queue_widget)
        hlayout.addWidget(self.availability_label)
        vlayout.addLayout(hlayout)
        vlayout.addWidget(self.num_tasks_widget)
        vlayout.addWidget(self.task_per_node_widget)
        vlayout.addWidget(self.runtime_widget)
        vlayout.addWidget(self.app_script_widget)
        vlayout.addSpacing(10)
        vlayout.addLayout(btnlayout)

        self.widget = QWidget()
        self.widget.setLayout(vlayout)

        self.setCentralWidget(self.widget)

        # self.setGeometry(300, 300, 350, 250)
        self.setWindowTitle("MyCluster Job Configurator")

        self.lineedits['job_name'].textChanged.connect(self.job_name_changed)
        self.lineedits['job_script'].textChanged.connect(self.job_script_changed)
        self.lineedits['job_name'].setText('myjob')
        self.lineedits['project_name'].setText('default')
        #self.lineedits['app_script'].setText('myscript.bsh')
        self.comboboxes['app_script'].setEditable(True)
        self.comboboxes['app_script'].lineEdit().editingFinished.connect(self.check_app_script)

        from mycluster import mycluster
        mycluster.init()

        self.init_queue_info()