예제 #1
0
    def __init__(self,title,parent,right_layout=None):
        super(SubTitleWidget,self).__init__(parent)

        self.title = QLabel()
        self.title.setObjectName("subtitle")
        self.title.setScaledContents(True)
        self.set_title(title)

        hlayout = QHBoxLayout()
        hlayout.setAlignment(Qt.AlignTop)
        # hlayout.addWidget(TitleBox(self))
        hlayout.addWidget(self.title)
        hlayout.addStretch()

        if right_layout:
            if isinstance(right_layout,QLayout):
                hlayout.addLayout(right_layout)
            else:
                hlayout.addWidget(right_layout)

        # hlayout.setStretch(1,1)

        top_layout = QVBoxLayout()
        top_layout.addLayout(hlayout)
        top_layout.addSpacing(10)
        top_layout.setContentsMargins(0,0,0,0)

        self.setLayout(top_layout)
        self.setContentsMargins(0,0,0,0)
예제 #2
0
    def setupUI(self):

        paneLayout = QHBoxLayout()
        paneLayout.setContentsMargins(0, 0, 0, 0)

        leftPane = QFrame()
        leftPane.setObjectName("leftPane")

        leftPaneLayout = QVBoxLayout()
        leftPaneLayout.setContentsMargins(20, 20, 20, 10)
        heading = QLabel("Select Employee: ")
        heading.setObjectName("heading")
        leftPaneLayout.addWidget(heading)
        leftPaneLayout.addSpacing(10)

        form1 = QFormLayout()
        form1.addRow(QLabel("Name"), self.nameSearch)
        form1.addRow(QLabel("ID No."), self.id)
        leftPaneLayout.addLayout(form1)
        leftPaneLayout.addStretch()
        leftPane.setLayout(leftPaneLayout)

        layout = QVBoxLayout()
        layout.setContentsMargins(20, 20, 20, 10)

        editGroup = QGroupBox("Edit below")
        form = QFormLayout()
        form.setContentsMargins(10, 10, 10, 30)
        form.setSpacing(20)
        form.addRow(QLabel("Name"), self.nameEdit)
        form.addRow(QLabel("Designation"), self.designation)
        form.addRow(QLabel("Original Pay"), self.originalPay)
        form.addRow(QLabel("Original Pay Grade"), self.originalPayGrade)
        form.addRow(QLabel("Date of joining"), self.DOJ)
        form.addRow(QLabel("Pan No."), self.pan)
        editGroup.setLayout(form)

        layout.addWidget(editGroup)
        layout.addStretch()
        bttnLayout = QHBoxLayout()
        bttnLayout.addStretch()
        bttnLayout.addWidget(self.bttnCancel)
        bttnLayout.addWidget(self.bttnSave)

        layout.addLayout(bttnLayout)

        paneLayout.addWidget(leftPane)
        paneLayout.addLayout(layout)
        self.setLayout(paneLayout)
예제 #3
0
 def __init__(self,
              loadIcon="loading_bar",
              primaryMessage="Please, Wait",
              message='',
              parent=None):
     super(LoadingWidget, self).__init__(parent)
     self.finished.connect(self._updateUI)
     self.setStyleSheet("""
   QWidget {
     background-color: #ffffff
   }
 """)
     self._icon_load = loadIcon
     self._primary_message = primaryMessage
     self._label_message = QLabel(message)
     self._label_message.setWordWrap(True)
     self._label_message.setAlignment(Qt.AlignCenter)
     self._label_primary_message = QLabel(self._primary_message)
     self._label_primary_message.setStyleSheet("""
   QLabel {
     font-size: 20px;
     font-weight:bold;
     color: rgb(65,65,65);
   }
 """)
     self._label_primary_message.setAlignment(Qt.AlignCenter)
     self._label_movie = QLabel()
     self._label_movie.setAlignment(Qt.AlignCenter)
     self._movie = QMovie(self._icon_load)
     self._label_movie.setMovie(self._movie)
     self._movie.start()
     layout = QVBoxLayout()
     layout.addWidget(self._label_primary_message)
     layout.addSpacing(5)
     layout.addWidget(self._label_message)
     layout.addSpacing(5)
     layout.addWidget(self._label_movie)
     layout.addStretch()
     #self._setupAnimation() # this should be done after showing everything to get correct geometries
     self.setLayout(layout)
 def __init__(self, loadIcon="loading_bar", primaryMessage="Please, Wait", message='', parent=None):
   super(LoadingWidget, self).__init__(parent)
   self.finished.connect(self._updateUI)
   self.setStyleSheet("""
     QWidget {
       background-color: #ffffff
     }
   """)
   self._icon_load = loadIcon
   self._primary_message = primaryMessage
   self._label_message = QLabel(message)
   self._label_message.setWordWrap(True)
   self._label_message.setAlignment(Qt.AlignCenter)
   self._label_primary_message = QLabel(self._primary_message)
   self._label_primary_message.setStyleSheet("""
     QLabel {
       font-size: 20px;
       font-weight:bold;
       color: rgb(65,65,65);
     }
   """)
   self._label_primary_message.setAlignment(Qt.AlignCenter)
   self._label_movie = QLabel()
   self._label_movie.setAlignment(Qt.AlignCenter)
   self._movie = QMovie(self._icon_load)
   self._label_movie.setMovie(self._movie)
   self._movie.start()
   layout = QVBoxLayout()
   layout.addWidget(self._label_primary_message)
   layout.addSpacing(5)
   layout.addWidget(self._label_message)
   layout.addSpacing(5)
   layout.addWidget(self._label_movie)
   layout.addStretch()
   #self._setupAnimation() # this should be done after showing everything to get correct geometries
   self.setLayout(layout)
예제 #5
0
    def setupUI(self):
        """Arranges GUI elements inside the widget properly"""

        paneLayout = QHBoxLayout()
        paneLayout.setContentsMargins(0, 0, 0, 0)

        leftPane = QFrame()
        leftPane.setObjectName("leftPane")

        leftPaneLayout = QVBoxLayout()
        leftPaneLayout.setContentsMargins(20, 20, 20, 10)
        heading = QLabel("Select Employee: ")
        heading.setObjectName("heading")
        leftPaneLayout.addWidget(heading)
        leftPaneLayout.addSpacing(10)

        datelayout = QHBoxLayout()
        datelayout.addWidget(QLabel("Salary for month of "))
        datelayout.addWidget(self.month)
        datelayout.addWidget(self.year)
        datelayout.addStretch()
        leftPaneLayout.addLayout(datelayout)

        leftForm = QFormLayout()
        leftForm.setSpacing(10)
        leftForm.addRow(QLabel("Name"), self.name)
        leftForm.addRow(QLabel("ID No."), self.id)
        leftPaneLayout.addLayout(leftForm)

        leftPaneLayout.addStretch()
        leftPane.setLayout(leftPaneLayout)
        paneLayout.addWidget(leftPane)

        layout = QVBoxLayout()
        layout.setContentsMargins(20, 20, 20, 10)
        form = QFormLayout()
        form.setSpacing(10)
        form.addRow(QLabel("Designation"), self.designation)
        form.addRow(QLabel("Original Pay"), self.originalPay)
        form.addRow(QLabel("Original Pay Grade"), self.originalPayGrade)
        form.addRow(QLabel("Date of joining"), self.DOJ)
        form.addRow(QLabel("Pan No."), self.pan)

        infoGroup = QGroupBox("Basic Info")
        infoGroup.setLayout(form)
        layout.addWidget(infoGroup)

        leftForm = QFormLayout()
        leftForm.addRow(QLabel("Dearness Allowance"), self.da_percent)
        leftForm.addRow(QLabel("Housing Rent Allowance"), self.hra_percent)
        leftForm.addRow(QLabel("Transport Allowance"), self.ta_percent)

        leftGroup = QGroupBox("Allowances")
        leftGroup.setLayout(leftForm)

        rightForm = QFormLayout()
        rightForm.addRow(QLabel("Income Tax"), self.it_percent)
        rightForm.addRow(QLabel("Profession Tax"), self.pt_percent)

        rightGroup = QGroupBox("Deductions")
        rightGroup.setLayout(rightForm)

        table = QHBoxLayout()
        table.addWidget(leftGroup)
        table.addWidget(rightGroup)

        layout.addLayout(table)

        layout.addStretch()
        bttnLayout = QHBoxLayout()
        bttnLayout.addStretch()
        bttnLayout.addWidget(self.bttnCancel)
        bttnLayout.addWidget(self.bttnCalculate)

        layout.addLayout(bttnLayout)

        paneLayout.addLayout(layout)
        self.setLayout(paneLayout)
예제 #6
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()
예제 #7
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()
예제 #8
0
파일: gui05.py 프로젝트: yysynergy/pparser
class MainWindow(QMainWindow):
    def __init__(self, datta):
        QMainWindow.__init__(self)
        self.setWindowTitle('Project Parser')
        appIcon = QIcon('search.png')
        self.setWindowIcon(appIcon)
        self.viewPortBL = QDesktopWidget().availableGeometry().topLeft()
        self.viewPortTR = QDesktopWidget().availableGeometry().bottomRight()
        self.margin = int(QDesktopWidget().availableGeometry().width()*0.1/2)
        self.shirina = QDesktopWidget().availableGeometry().width() - self.margin*2
        self.visota = QDesktopWidget().availableGeometry().height() - self.margin*2
        self.setGeometry(self.viewPortBL.x() + self.margin, self.viewPortBL.y() + self.margin,
                         self.shirina, self.visota)
        # statusbar
        self.myStatusBar = QStatusBar()
        self.setStatusBar(self.myStatusBar)
        
        #lower long layout
        self.lowerLong = QFrame()
        self.detailsLabel = QLabel()
        self.skillsLabel = QLabel()
        self.urlLabel = QLabel()
        self.locationLabel = QLabel()
        self.skillsLabel.setText('skills')
        self.detailsLabel.setWordWrap(True)
        self.la = QVBoxLayout()
        self.la.addWidget(self.detailsLabel)
        self.la.addWidget(self.skillsLabel)
        self.la.addWidget(self.urlLabel)
        self.la.addWidget(self.locationLabel)
        self.lowerLong.setLayout(self.la)

        # table
        self.source_model = MyTableModel(self, datta, ['Id', 'Date', 'Title'])
        self.proxy_model = myTableProxy(self)
        self.proxy_model.setSourceModel(self.source_model)
        self.proxy_model.setDynamicSortFilter(True)
        self.table_view = QTableView()
        self.table_view.setModel(self.proxy_model)
        self.table_view.setAlternatingRowColors(True)
        self.table_view.resizeColumnsToContents()
        self.table_view.resizeRowsToContents()
        self.table_view.horizontalHeader().setStretchLastSection(True)
        self.table_view.setSortingEnabled(True)
        self.table_view.sortByColumn(2, Qt.AscendingOrder)

        # events
        self.selection = self.table_view.selectionModel()
        self.selection.selectionChanged.connect(self.handleSelectionChanged)
        #DO NOT use CreateIndex() method, use index()
        index = self.proxy_model.index(0,0)
        self.selection.select(index, QItemSelectionModel.Select)
        
        self.upperLong = self.table_view  

        # right side widgets
        self.right = QFrame()
        self.la1 = QVBoxLayout()
        self.btnDownload = QPushButton('Download data')
        self.btnDownload.clicked.connect(self.download)
        self.myButton = QPushButton('Show Skillls')
        self.myButton.clicked.connect(self.showAllSkills)
        self.btnSearchByWord = QPushButton('Search by word(s)')
        self.btnSearchByWord.clicked.connect(self.onSearchByWord)
        self.btnResetFilter= QPushButton('Discard Filter')
        self.btnResetFilter.clicked.connect(self.discardFilter)
        self.btnCopyURL = QPushButton('URL to Clipboard')
        self.btnCopyURL.clicked.connect(self.copyToClipboard)
        self.btnExit = QPushButton('Exit')
        self.btnExit.clicked.connect(lambda: sys.exit())
        self.dateTimeStamp = QLabel()
        self.la1.addWidget(self.btnDownload)
        self.la1.addSpacing(10)
        self.la1.addWidget(self.myButton)
        self.la1.addSpacing(10)
        self.la1.addWidget(self.btnSearchByWord)
        self.la1.addSpacing(10)
        self.la1.addWidget(self.btnResetFilter)
        self.la1.addSpacing(10)
        self.la1.addWidget(self.btnCopyURL)
        self.la1.addSpacing(70)
        self.la1.addWidget(self.btnExit)
        self.la1.addStretch(stretch=0)
        self.la1.addWidget(self.dateTimeStamp)
        self.right.setLayout(self.la1)
        self.right.setFrameShape(QFrame.StyledPanel)

        # splitters
        self.horiSplit = QSplitter(Qt.Vertical)
        self.horiSplit.addWidget(self.upperLong)
        self.horiSplit.addWidget(self.lowerLong)
        self.horiSplit.setSizes([self.visota/2, self.visota/2])
        self.vertiSplit = QSplitter(Qt.Horizontal)
        self.vertiSplit.addWidget(self.horiSplit)
        self.vertiSplit.addWidget(self.right)
        self.vertiSplit.setSizes([self.shirina*3/4, self.shirina*1/4])
        self.setCentralWidget(self.vertiSplit)
        
        self.settings = QSettings('elance.ini', QSettings.IniFormat)
        self.settings.beginGroup('DATE_STAMP')
        self.dateTimeStamp.setText('Data actuality: %s' % self.settings.value('date/time'))
        self.settings.endGroup()
        self.statusText = ''

    def handleSelectionChanged(self, selected, deselected):
        for index in selected.first().indexes():
            #print('Row %d is selected' % index.row())
            ind = index.model().mapToSource(index)
            desc = ind.model().mylist[ind.row()]['Description']
            self.detailsLabel.setText(desc)
            skills = ', '.join(ind.model().mylist[ind.row()]['Skills']).strip()
            self.skillsLabel.setText(skills)
            url = ind.model().mylist[ind.row()]['URL']
            self.urlLabel.setText(url)
            location = ind.model().mylist[ind.row()]['Location']
            self.locationLabel.setText(location)
    
    def showAllSkills(self):
        listSkills = []
        for elem in self.source_model.mylist:
            listSkills += elem['Skills']
        allSkills = Counter(listSkills)
        tbl = MyTableModel(self, allSkills.items(), ['Skill', 'Freq'])
        win = skillsWindow(tbl, self.table_view)
        win.exec_()
    
    def discardFilter(self):
        self.table_view.model().emit(SIGNAL("modelAboutToBeReset()"))
        self.table_view.model().criteria = {}
        self.table_view.model().emit(SIGNAL("modelReset()"))
        self.table_view.resizeRowsToContents()
        
    def download(self):
        self.btnDownload.setDisabled(True)
        self.statusLabel = QLabel('Connecting')
        self.progressBar = QProgressBar()
        self.progressBar.setMinimum(0)
        self.progressBar.setMaximum(100)
        self.myStatusBar.addWidget(self.statusLabel, 2)
        self.myStatusBar.addWidget(self.progressBar, 1)
        self.progressBar.setValue(1)
        self.settings.beginGroup('URLS')
        initialLink = self.settings.value('CategoriesDetailed/VahaSelected/InitialLink')
        pagingLink = self.settings.value('CategoriesDetailed/VahaSelected/PagingLink')
        self.settings.endGroup()
        downloader = Downloader(initialLink, pagingLink, 25, 5)
        downloader.messenger.downloadProgressChanged.connect(self.onDownloadProgressChanged)
        downloader.messenger.downloadComplete.connect(self.onDownloadComplete)
        downloader.download()
    
    def onDownloadComplete(self):
        #QMessageBox.information(self, 'Download complete', 'Download complete!', QMessageBox.Ok)
        self.table_view.model().emit(SIGNAL("modelAboutToBeReset()"))
        self.settings.beginGroup('DATE_STAMP')
        self.settings.setValue('date/time', time.strftime('%d-%b-%Y, %H:%M:%S'))
        self.dateTimeStamp.setText('Data actuality: %s' % self.settings.value('date/time'))
        self.settings.endGroup()
        with open("elance.json") as json_file:
            jobDB = json.load(json_file)
        for elem in jobDB:
            words = nltk.tokenize.regexp_tokenize(elem['Title'].lower(), r'\w+')
            elem['Tokens'] = words
            elem['Skills'] = [t.strip() for t in elem['Skills'].split(',')]
        self.source_model.mylist = jobDB
        self.table_view.model().emit(SIGNAL("modelReset()"))
        self.btnDownload.setEnabled(True)
        self.myStatusBar.removeWidget(self.statusLabel)
        self.myStatusBar.removeWidget(self.progressBar)
        self.myStatusBar.showMessage(self.statusText, timeout = 5000)
                
    
    def onDownloadProgressChanged(self, stata):
        self.progressBar.setValue(stata[2])
        #text = 'Processed records{:5d} of{:5d}'.format(percentage[0], percentage[1])
        bajtikov = '{:,}'.format(stata[5])
        self.statusText = 'Processed page{:4d} of{:4d}. \
               Job entries{:5d} of{:5d}. \
               Downloaded{:>12s} Bytes'.format(stata[3], stata[4],
                                              stata[0], stata[1],
                                              bajtikov)
        self.statusLabel.setText(self.statusText)
        
    def copyToClipboard(self):
        clipboard = QApplication.clipboard()
        clipboard.setText(self.urlLabel.text())
        self.myStatusBar.showMessage(self.urlLabel.text(), timeout = 3000)
    
    def onSearchByWord(self):
        text, ok = QInputDialog.getText(self, 'Search the base by word(s)', 'Enter your keyword/phrase to search for:')
        if ok:
            words = [t.strip() for t in nltk.tokenize.regexp_tokenize(text.lower(), r'\w+')]
            self.table_view.model().emit(SIGNAL("modelAboutToBeReset()"))
            self.table_view.model().criteria = {'Description' : words}
            self.table_view.model().emit(SIGNAL("modelReset()"))
예제 #9
0
    def setupUI(self):
        layout = QVBoxLayout()
        layout.setAlignment(Qt.AlignHCenter)

        self.setContentsMargins(20, 10, 20, 5)
        banner = QHBoxLayout()
        banner.addWidget(self.logo)
        bannerText = QVBoxLayout()
        text = QLabel("Salary Management System")
        text.setStyleSheet("font-size: 30px;")
        bannerText.addWidget(text)
        bannerText.setAlignment(text, Qt.AlignBottom)
        text2 = QLabel("Indian Institute of Information Technology Kalyani")
        text2.setStyleSheet("font-size: 20px;")
        bannerText.addWidget(text2)
        bannerText.setAlignment(text2, Qt.AlignTop)
        banner.addLayout(bannerText)
        banner.addStretch()
        layout.addLayout(banner)
        layout.addSpacing(30)

        bttnList = [
            self.bttnAddDesignation, self.bttnDelDesg, self.bttnEditDesg,
            self.bttnShowDesg, self.bttnShowEmp, self.bttnEditEmp,
            self.bttnAddEmployee, self.bttnDelEmp, self.bttnSettings,
            self.bttnCalcSalary
        ]
        for bttn in bttnList:
            bttn.setObjectName("HomeBttn")
            bttn.setIconSize(QSize(55, 55))

        employeeGroup = QGroupBox("Employee")
        employeeGroupLayout = QVBoxLayout()
        employeeGroupLayout.addWidget(self.bttnAddEmployee)
        employeeGroupLayout.addWidget(self.bttnEditEmp)
        employeeGroupLayout.addWidget(self.bttnDelEmp)
        employeeGroupLayout.addWidget(self.bttnShowEmp)
        employeeGroup.setLayout(employeeGroupLayout)

        designationGroup = QGroupBox("Designation")
        designationGroupLayout = QVBoxLayout()
        designationGroupLayout.addWidget(self.bttnAddDesignation)
        designationGroupLayout.addWidget(self.bttnEditDesg)
        designationGroupLayout.addWidget(self.bttnDelDesg)
        designationGroupLayout.addWidget(self.bttnShowDesg)
        designationGroup.setLayout(designationGroupLayout)

        groups = QHBoxLayout()
        groups.addWidget(employeeGroup)
        groups.addWidget(designationGroup)

        otherBttns = QGroupBox()
        otherBttnsLayout = QVBoxLayout()
        otherBttnsLayout.addWidget(self.bttnCalcSalary)
        otherBttnsLayout.addWidget(self.bttnSettings)
        otherBttnsLayout.addStretch()
        otherBttns.setLayout(otherBttnsLayout)
        groups.addWidget(otherBttns)

        groups.addStretch()

        layout.addLayout(groups)

        layout.addStretch()

        version = QLabel(version_text)
        layout.addWidget(version)

        centerLayout = QHBoxLayout()
        centerLayout.addStretch()
        centerLayout.addLayout(layout)
        centerLayout.addStretch()
        self.setLayout(centerLayout)