def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self.__parent = parent
        self.setWindowTitle("Add Employee")
        self.id = QLineEdit(self)
        self.id.setValidator(QRegExpValidator(QRegExp("[a-zA-Z0-9-_]+")))
        self.name = QLineEdit(self)
        self.name.setValidator(QRegExpValidator(QRegExp("[a-zA-Z\s]+")))
        self.designation = QComboBox(self)

        # self.designation.addItems(DatabaseManager.db.getDesignations())

        self.originalPay = QLineEdit(self)
        self.originalPay.setValidator(QDoubleValidator())
        self.originalPayGrade = QLineEdit(self)
        self.originalPayGrade.setValidator(QDoubleValidator())
        self.DOJ = DatePicker(self)
        self.pan = QLineEdit(self)
        self.pan.setValidator(QRegExpValidator(QRegExp("[A-Z]{5}\d{4}[A-Z]")))

        self.bttnAddEmployee = QPushButton("Add Employee")
        self.bttnCancel = QPushButton("Cancel")
        self.bttnAddEmployee.setObjectName("OkButton")
        self.bttnCancel.setObjectName("CancelButton")
        self.bttnCancel.clicked.connect(self.goBack)
        self.bttnAddEmployee.clicked.connect(self.add)

        self.designation.addItems(DatabaseManager.db.getDesignations())

        self.setupUI()
Example #2
0
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        self.setupUi(self)

        #Validators for data input
        ipRange = "(?:[0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])"
        ipRegex = QRegExp("^" + ipRange + "\\." + ipRange + "\\." + ipRange +
                          "\\." + ipRange + "$")
        ipValidator = QRegExpValidator(self.leGraylogIP)
        ipValidator.setRegExp(ipRegex)
        self.leGraylogIP.setValidator(ipValidator)
        self.leGraylogPort.setValidator(QIntValidator(1, 65535))
        self.leGraylogHttpPort.setValidator(QIntValidator(1, 65535))

        ipValidator = QRegExpValidator(self.leAsterixIP)
        ipValidator.setRegExp(ipRegex)
        self.leAsterixIP.setValidator(ipValidator)
        self.leAsterixPort.setValidator(QIntValidator(1, 65535))
        self.leAsterixSic.setValidator(QIntValidator(1, 256))

        self.leIamodPort.setValidator(QIntValidator(1, 65535))
        self.leIamodThreshold.setValidator(QIntValidator(0, 99999))

        #Define functions for GUI actions
        self.pbStart.clicked.connect(self.__startServer)
        self.pbStop.clicked.connect(self.__stopServer)
        self.actionLicense.triggered.connect(self.__license)
        self.actionLoad_Config_File.triggered.connect(self.__dialogConfigFile)

        self.pbSaveConfiguration.clicked.connect(self.__writeConfigFile)
        self.pbStart.setEnabled(False)

        if self.__checkServerIsRunning():
            self.__serverStatusImage(True)
        else:
            self.__serverStatusImage(False)

        self.configFile = ConfigParser.ConfigParser()

        self.view = QWebView()
        self.webLayout.addWidget(self.view)

        self.view.settings().setAttribute(
            QWebSettings.JavascriptCanOpenWindows, True)
        self.view.settings().setAttribute(QWebSettings.LocalStorageEnabled,
                                          True)

        self.pbConnect.clicked.connect(self.__connectHttpServer)

        l = QVBoxLayout(self.tab2)
        sc = StaticCanvas(self.tab2, width=5, height=4, dpi=100)
        dc = DynamicCanvas(self.tab2, width=5, height=4, dpi=100)
        l.addWidget(sc)
        l.addWidget(dc)
Example #3
0
 def __init__(self, parent=None):
     super().__init__(parent)
     regex = QRegExp(r"^M?M?M?(?:CM|CD|D?C?C?C?)"
                     r"(?:XC|XL|L?X?X?X?)(?:IX|IV|V?I?I?I?)$")
     regex.setCaseSensitivity(Qt.CaseInsensitive)
     self.validator = QRegExpValidator(regex, self)
     self.setRange(1, 3999)
     self.lineEdit().textEdited.connect(self.fixCase)
Example #4
0
    def initHandlers(self):
        self.setWindowTitle(translateTitleMap[self.mode])
        self.ui.cbLang.setCurrentIndex(self.wordInfo.srcLang.value)
        if self.wordModel.srcLang == utils.Lang.Eng:
            self.ui.leWord.setValidator(
                QRegExpValidator(QRegExp(utils.rxEng), self))
        if self.wordModel.srcLang == utils.Lang.Rus:
            self.ui.leWord.setValidator(
                QRegExpValidator(QRegExp(utils.rxRus), self))

        self.ui.leWord.setText(self.wordModel.wordValue)
        self.ui.teMeaning.setText(self.wordModel.wordMeaning)

        self.ui.btnCancel.clicked.connect(self._onCancel)
        self.ui.btnSave.clicked.connect(self._onOK)
        self.ui.actDownOrder.triggered.connect(self._onDownOrder)
        self.ui.actUpOrder.triggered.connect(self._onUpOrder)
        self.ui.actAddTranslate.triggered.connect(self._onAddTranslate)
Example #5
0
 def __init__(self, gui, index):
     ObsLightWizardPage.__init__(self, gui, index,
                                 u"wizard_configProjectAlias.ui")
     noSpaceValidator = QRegExpValidator(PROJECT_ALIAS_REGEXP, self)
     self.ui_WizardPage.aliasLineEdit.setValidator(noSpaceValidator)
     self.registerField(u"projectAlias*", self.ui_WizardPage.aliasLineEdit)
     self.registerField(u"CreateChroot",
                        self.ui_WizardPage.createChrootCheckBox)
     self.setCommitPage(True)
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self.__parent = parent

        # ------elements for selecting employee-----------
        self.nameSearch = SearchBox(self)
        self.nameSearch.setPlaceholderText("Enter Name")
        self.nameSearch.returnPressed.connect(self.setIDList)
        # self.name.currentIndexChanged.connect(self.setIDList)
        self.nameList = []
        self.nameList = DatabaseManager.db.getEmployeeNameList()
        self.nameSearch.setList(self.nameList)
        self.nameSearch.setCurrentIndex(-1)

        self.id = QComboBox()
        self.id.currentIndexChanged.connect(lambda: self.loadInfo(self.id.currentText()))

        # ------elements for ediiting employee-----------
        self.nameEdit = QLineEdit(self)
        self.nameEdit.setValidator(QRegExpValidator(QRegExp("[a-zA-Z\s]+")))
        self.designation = QComboBox(self)

        self.originalPay = QLineEdit(self)
        self.originalPay.setValidator(QDoubleValidator())
        self.originalPayGrade = QLineEdit(self)
        self.originalPayGrade.setValidator(QDoubleValidator())
        self.DOJ = DatePicker(self)
        self.pan = QLineEdit(self)
        self.pan.setValidator(QRegExpValidator(QRegExp("[A-Z]{5}\d{4}[A-Z]")))

        self.bttnSave = QPushButton("Save Changes")
        self.bttnCancel = QPushButton("Back")
        self.bttnSave.setObjectName("OkButton")
        self.bttnCancel.setObjectName("CancelButton")
        self.bttnCancel.clicked.connect(self.goBack)
        self.bttnSave.clicked.connect(self.save)

        self.designation.addItems(DatabaseManager.db.getDesignations())
        self.nameSearch.editTextChanged.connect(self.clearInfo)
        self.clearInfo()

        self.setupUI()
Example #7
0
    def __loadWidgets(self):
        self.disableOkButton()
        httpValidator = QRegExpValidator(URL_REGEXP, self)
        self.__srvConfDialog.serverWebUrlLineEdit.setValidator(httpValidator)
        self.__srvConfDialog.serverWebUrlLineEdit.textEdited.connect(self.disableOkButton)

        self.__srvConfDialog.serverApiLineEdit.setValidator(httpValidator)
        self.__srvConfDialog.serverApiLineEdit.textEdited.connect(self.disableOkButton)

        self.__srvConfDialog.serverRepoLineEdit.setValidator(httpValidator)
        self.__srvConfDialog.serverRepoLineEdit.textEdited.connect(self.disableOkButton)

        # Qt 4.6 do not know "setPlaceholderText"
        if hasattr(QLineEdit, "setPlaceholderText"):
            self.__srvConfDialog.serverWebUrlLineEdit.setPlaceholderText(u"http://myObs")
            self.__srvConfDialog.serverApiLineEdit.setPlaceholderText(u"http://myObs:81")
            self.__srvConfDialog.serverRepoLineEdit.setPlaceholderText(u"http://myObs:82")

        noSpaceValidator = QRegExpValidator(SERVER_ALIAS_REGEXP, self)
        self.__srvConfDialog.serverAliasLineEdit.setValidator(noSpaceValidator)

        self.__srvConfDialog.checkConnectionButton.clicked.connect(self.on_checkConnectionButton_clicked)
Example #8
0
 def createEditor(self, parent, option, index):
     if index.column() == NODE_NAME:
         rename_editor = QLineEdit(parent)
         rename_editor.setValidator(
             QRegExpValidator(QRegExp(r'[a-zA-Z_]+[a-zA-Z0-9_:]*'), self))
         return rename_editor
     elif index.column() == NODE_FILE:
         # filename_editor = QLineEdit(parent)
         filename_editor = PathEditor(parent, index)
         filename_editor.editingFinished.connect(
             self.commit_and_close_editor)
         return filename_editor
     else:
         return QStyledItemDelegate.createEditor(self, parent, option,
                                                 index)
    def __init__(self, gui, index):
        ObsLightWizardPage.__init__(self, gui, index,
                                    u"wizard_chooseRepository.ui")
        httpValidator = QRegExpValidator(URL_REGEXP, self)
        self.ui_WizardPage.repositoryUrlEdit.setValidator(httpValidator)

        self.ui_WizardPage.AddRepositoryButton.clicked.connect(
            self.on_AddRepositoryButton_clicked)
        self.ui_WizardPage.DelRepositoryButton.clicked.connect(
            self.on_DelRepositoryButton_clicked)

        #        self.ui_WizardPage.autoAddRepoButton.stateChanged.connect(self._checkAutoAddRepoButton)

        self.__repoList = []
        self.__addLocalProject = True
Example #10
0
    def __init__(self, gui, index):
#        ObsLightWizardPage.__init__(self, gui, index, u"wizard_newPackage.ui")
        ObsLightWizardPage.__init__(self, gui, index, u"wizard_newPackageFromGit.ui")
        packageNameValidator = QRegExpValidator(PACKAGE_NAME_REGEXP, self)
        self.ui_WizardPage.packageNameLineEdit.setValidator(packageNameValidator)
        self.registerField(u"newPackageName*",
                           self.ui_WizardPage.packageNameLineEdit)
        self.registerField(u"newPackageTitle",
                           self.ui_WizardPage.packageTitleLineEdit)
        self.registerField(u"newPackageDescription",
                           self.ui_WizardPage.packageDescriptionTextEdit)
        self.registerField(u"newPackageGitUrl",
                           self.ui_WizardPage.gitUrlLineEdit)

        self.registerField(u"gitSubDirLineEdit",
                           self.ui_WizardPage.gitSubDirLineEdit)
Example #11
0
 def on_makePatchButton_clicked(self):
     project = self.getCurrentProject()
     package = self.currentPackage()
     if project is None or package is None:
         return
     dialog = QInputDialog(self.mainWindow)
     dialog.setInputMode(QInputDialog.TextInput)
     dialog.setLabelText(u"Patch name (should end with <i>.patch</i>):")
     dialog.setWindowTitle(u"Choose patch name...")
     le = dialog.findChildren(QLineEdit)
     if len(le) > 0:
         validator = QRegExpValidator(PATCH_NAME_REGEXP, le[0])
         le[0].setText(u".patch")
         le[0].setValidator(validator)
     dialog.textValueSelected.connect(self.__createPatch)
     dialog.show()
Example #12
0
    def __init__(self, parent=None):
        super(LoggingOptions, self).__init__()

        self.setTitle('Logging Options')

        self.layout = QVBoxLayout(self)

        self.chbox_include_timestamps = QCheckBox('Include timestamps')
        self.layout.addWidget(self.chbox_include_timestamps)

        self.chbox_equal_lines = QCheckBox(("Ignore if timestamps and values "
                                            "don't change"))
        self.layout.addWidget(self.chbox_equal_lines)

        self.hbox_bad_quality = QHBoxLayout(self)
        self.label_bad_quality = QLabel(('Value to log if reading '
                                         'quality is bad'), self)
        self.hbox_bad_quality.addWidget(self.label_bad_quality)
        self.le_bad_quality = QLineEdit(self)
        self.le_bad_quality.setText('bad')
        regex = QRegExp('[a-zA-Z0-9]+')
        validator = QRegExpValidator(regex)
        self.le_bad_quality.setValidator(validator)
        self.hbox_bad_quality.addWidget(self.le_bad_quality)
        self.layout.addLayout(self.hbox_bad_quality)

        self.hbox_separator = QHBoxLayout(self)
        self.label_separator = QLabel('CSV separator', self)
        self.hbox_separator.addWidget(self.label_separator)
        self.le_separator = QLineEdit(self)
        self.le_separator.setText(';')
        self.hbox_separator.addWidget(self.le_separator)
        self.layout.addLayout(self.hbox_separator)

        self.chbox_print_exceptions = QCheckBox(('Print exceptions as '
                                                 'comment'))
        self.layout.addWidget(self.chbox_print_exceptions)

        self.hbox_comment_char = QHBoxLayout(self)
        self.label_comment_char = QLabel('Comment escape character', self)
        self.hbox_comment_char.addWidget(self.label_comment_char)
        self.le_comment_char = QLineEdit(self)
        self.le_comment_char.setText("'")
        self.hbox_comment_char.addWidget(self.le_comment_char)
        self.layout.addLayout(self.hbox_comment_char)

        self.setLayout(self.layout)
Example #13
0
    def __init__(self, gui, index):
        ObsLightWizardPage.__init__(self, gui, index,
                                    u"wizard_configServerUrl.ui")

        httpValidator = QRegExpValidator(URL_REGEXP, self)
        self.ui_WizardPage.webUrlLineEdit.setValidator(httpValidator)
        self.ui_WizardPage.apiUrlLineEdit.setValidator(httpValidator)
        self.ui_WizardPage.repoUrlLineEdit.setValidator(httpValidator)
        for pc in self.preConfiguredServerList:
            self.ui_WizardPage.preConfiguredServerCBox.addItem(
                pc['serverAlias'], pc)
        self.ui_WizardPage.preConfiguredServerCBox.currentIndexChanged.connect(
            self.autoConfServer)

        self.registerField(u"webUrl*", self.ui_WizardPage.webUrlLineEdit)
        self.registerField(u"apiUrl*", self.ui_WizardPage.apiUrlLineEdit)
        self.registerField(u"repoUrl*", self.ui_WizardPage.repoUrlLineEdit)
        self.registerField(u"username*", self.ui_WizardPage.usernameLineEdit)
        self.registerField(u"password*", self.ui_WizardPage.passwordLineEdit)
Example #14
0
    def __init__(self, parent=None):
        super(ReadOptions, self).__init__()

        self.setTitle('Reading Options')

        self.layout = QVBoxLayout(self)

        self.label_poolling_rate = QLabel('Pooling Rate (ms)', self)
        self.layout.addWidget(self.label_poolling_rate)

        self.le_poolling_rate = QLineEdit(self)
        self.le_poolling_rate.setText('200')
        regex = QRegExp('[0-9]+')
        validator = QRegExpValidator(regex)
        self.le_poolling_rate.setValidator(validator)
        self.layout.addWidget(self.le_poolling_rate)

        self.chbox_sync = QCheckBox("Synchronous read")
        self.layout.addWidget(self.chbox_sync)

        self.setLayout(self.layout)
Example #15
0
    def __init__(self, gui, projectAlias=None):
        QObject.__init__(self)
        ObsLightGuiObject.__init__(self, gui)
        self.__projectAlias = projectAlias
        self.__configDialog = self.gui.loadWindow(u"obsProjectConfig.ui")
        self.__projectObsNameEdited = False

        # obslight do not like whitespace characters
        noSpaceValidator = QRegExpValidator(PROJECT_ALIAS_REGEXP, self)
        self.__configDialog.projectLocalNameLineEdit.setValidator(
            noSpaceValidator)

        self.__obsNameCompleter = None
        self.__loadInitialFieldValues()
        self.__makeConnections()
        if self.__isNewProject():
            self.handleServerChanged()
        self.__configDialog.accepted.connect(self.on_configDialog_accepted)
        self.__configDialog.rejected.connect(self.on_configDialog_rejected)
        obsProjectConfigButtonBox = self.__configDialog.obsProjectConfigButtonBox
        obsProjectConfigButtonBox.button(QDialogButtonBox.Ok).clicked.connect(
            self.validate)
        self.__configDialog.show()
        self.__undefaultButtons()
 def __init__(self, gui, index):
     ObsLightWizardPage.__init__(self, gui, index, u"wizard_configServerAlias.ui")
     noSpaceValidator = QRegExpValidator(SERVER_ALIAS_REGEXP, self)
     self.ui_WizardPage.aliasLineEdit.setValidator(noSpaceValidator)
     self.registerField(u"serverAlias*", self.ui_WizardPage.aliasLineEdit)
     self.setCommitPage(True)
Example #17
0
 def _getFreqValidator():
     freqRegExp = QRegExp("^\\d*\.?\\d*[GgMm]?$")
     return QRegExpValidator(freqRegExp)
 def setUp(self):
     self.validator = QRegExpValidator(QRegExp(utils.rxEng), None)