Example #1
0
    def _initUI(self):               
        self.setWindowTitle('The Inventory ' + settings.getVersionString())
        self.setGeometry(300, 300, 1340, 720)

        # status bar
        self.statusBar().showMessage('Ready')

        # main menu
        #menu_db_recreateLists.setShortcut('Ctrl+L')
        mainmenu = self.menuBar()
        # menu database
        menu_db = mainmenu.addMenu('&Database')
        menu_db_download = QtGui.QAction('&Download', self)
        menu_db_download.setStatusTip('Download whole database to one file.')
        menu_db_download.triggered.connect(self._action_db_download)
        menu_db.addAction(menu_db_download)
        if settings.debug:
            menu_db_recreateLists = QtGui.QAction('Recreate &lists', self)
            menu_db_recreateLists.setStatusTip('Recreate lists from defaults. Use for updating lists when changed in code.')
            menu_db_recreateLists.triggered.connect(self._action_db_recreateLists)
            menu_db.addAction(menu_db_recreateLists)
        # menu about
        menu_about = mainmenu.addMenu('&About')
        menu_about_version = QtGui.QAction('Program &version', self)
        menu_about_version.setStatusTip('Show version of The Inventory program.')
        menu_about_version.triggered.connect(self._action_about_programVersion)
        menu_about.addAction(menu_about_version)

        # mdi area
        self.mdi = QtGui.QMdiArea()
        self.setCentralWidget(self.mdi)
Example #2
0
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        
        self.search = None

        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.setWindowTitle('The Inventory ' + settings.getVersionString())
        self.connectToDatabase()

        #  /=====================================\
        #  |            SLOTS/SIGNALS            |
        # buttons
        self.ui.btnAddItem.clicked.connect(self.itemEditor_newItem)
        self.ui.btnEditItem.clicked.connect(self.itemEditor_editItem)
        self.ui.btnDuplicateItem.clicked.connect(self.itemEditor_duplicateItem)
        self.ui.btnDeleteItem.clicked.connect(self.deleteItem)
        # itemList
        self.ui.itemList.itemSelectionChanged.connect(self.itemList_selectionChanged)
        # searching
        self.ui.btnSearchQuick.clicked.connect(self.search_quick)
        # menu
        self.ui.actionRecreateLists.triggered.connect(self.menuDatabase_actionRecreateLists)
        self.ui.actionDownloadDatabase.triggered.connect(self.menuDatabase_actionDownloadDatabase)
        self.ui.actionProgramVersion.triggered.connect(self.menuAbout_actionProgramVersion)
        #  |            SLOTS/SIGNALS            |
        #  \=====================================/
        self.itemList_refresh()
        self.itemProperties_showItem(None)
Example #3
0
    def itemProperties_showItem(self, item):
        self.ui.itemProperties.clear()
        if item is not None:
            preparedList = []
            if '_id' in item: preparedList.append(('Object ID:', str(item['_id'])))
            if 'created' in item: preparedList.append(('Created:', str(item['created'])))
            if 'modified' in item: preparedList.append(('Modified:', str(item['modified'])))
            if 'programVersion' in item: preparedList.append(('Program version:', settings.getVersionString(item['programVersion'])))
            if 'name' in item: preparedList.append(('Name:', item['name']))
            if 'category' in item: preparedList.append(('Category:', item['category']))
            if 'container' in item: preparedList.append(('Container:', item['container']))
            if 'amount' in item: preparedList.append(('Amount:', str(item['amount'])))
            if 'amountUnit' in item: preparedList.append(('Amount unit:', item['amountUnit']))
            if 'flags' in item: preparedList.append(('Flags:', str.join(', ', item['flags'])))
            if 'description' in item: preparedList.append(('Description:', item['description']))
            if 'tags' in item: preparedList.append(('Tags:', str.join(', ', item['tags'])))
            if 'brand' in item: preparedList.append(('Brand:', item['brand']))
            if 'model' in item: preparedList.append(('Model:', item['model']))
            if 'version' in item: preparedList.append(('Version:', item['version']))
            if 'serialNumber' in item: preparedList.append(('Serial number:', item['serialNumber']))
            if 'buyDate' in item: preparedList.append(('Buy date:', str(item['buyDate'])))
            if 'buyPlace' in item: preparedList.append(('Buy place:', item['buyPlace']))
            if 'warranty' in item: preparedList.append(('Warranty:', str(item['warranty']) + ' months'))
            if 'price' in item: preparedList.append(('Price:', str(item['price']) + ' zł'))
            if 'colors' in item: preparedList.append(('Colors:', str.join(', ', item['colors'])))
            if 'materials' in item: preparedList.append(('Materials:', str.join(', ', item['materials'])))
            if 'weight' in item: preparedList.append(('Weight:', str(item['weight']) + ' g'))
            if 'width' in item: preparedList.append(('Width:', str(item['width']) + ' mm'))
            if 'height' in item: preparedList.append(('Height:', str(item['height']) + ' mm'))
            if 'depth' in item: preparedList.append(('Depth:', str(item['depth']) + ' mm'))
            if 'radius1' in item: preparedList.append(('Radius 1:', str(item['radius1']) + ' mm'))
            if 'radius2' in item: preparedList.append(('Radius 2:', str(item['radius2']) + ' mm'))
            if 'containerLabel' in item: preparedList.append(('Container label:', item['containerLabel']))
            if 'containerCategories' in item: preparedList.append(('Allowed categories:', str.join(', ', item['containerCategories'])))

            for prepared in preparedList:
                field = QtGui.QTreeWidgetItem(self.ui.itemProperties, prepared)
                field.setBackgroundColor(0, QtGui.QColor(255,230,192))
                value = QtGui.QTreeWidgetItem(field)
                label = QtGui.QLabel(prepared[1])
                label.setWordWrap(True)
                self.ui.itemProperties.setItemWidget(value, 0, label)
            self.ui.itemProperties.expandAll()
Example #4
0
 def _action_about_programVersion(self):
     QtGui.QMessageBox.information(self, 'Program version', 'Current program version: ' + settings.getVersionString())
Example #5
0
 def menuAbout_actionProgramVersion(self):
     QMessageBox.information(self, 'Program version', 'Current program version: ' + settings.getVersionString())