def setupUi(self, Form): Form.setObjectName("Form") Form.resize(560, 560) sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth()) Form.setSizePolicy(sizePolicy) Form.setMinimumSize(QtCore.QSize(0, 0)) self.gridLayout_2 = QGridLayout(Form) self.gridLayout_2.setObjectName("gridLayout_2") self.editorGroupBox = QGroupBox(Form) sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth( self.editorGroupBox.sizePolicy().hasHeightForWidth()) self.editorGroupBox.setSizePolicy(sizePolicy) self.editorGroupBox.setMinimumSize(QtCore.QSize(0, 0)) self.editorGroupBox.setObjectName("editorGroupBox") self.gridLayout_3 = QGridLayout(self.editorGroupBox) self.gridLayout_3.setObjectName("gridLayout_3") self.gridLayout = QGridLayout() self.gridLayout.setObjectName("gridLayout") self.variable_verticalLayout_1 = QVBoxLayout() self.variable_verticalLayout_1.setObjectName( "variable_verticalLayout_1") self.listBox = QListWidget(self.editorGroupBox) sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth( self.listBox.sizePolicy().hasHeightForWidth()) self.listBox.setSizePolicy(sizePolicy) self.listBox.setDragEnabled(True) self.listBox.setDragDropOverwriteMode(False) self.listBox.setDragDropMode(QAbstractItemView.InternalMove) self.listBox.setDefaultDropAction(QtCore.Qt.MoveAction) self.listBox.setAlternatingRowColors(True) self.listBox.setSelectionMode(QAbstractItemView.SingleSelection) self.listBox.setMovement(QListView.Snap) self.listBox.setResizeMode(QListView.Fixed) self.listBox.setSelectionRectVisible(False) self.listBox.setObjectName("listBox") self.variable_verticalLayout_1.addWidget(self.listBox) self.gridLayout.addLayout(self.variable_verticalLayout_1, 0, 0, 1, 1) self.variable_verticalLayout_2 = QVBoxLayout() self.variable_verticalLayout_2.setObjectName( "variable_verticalLayout_2") self.addButton = QPushButton(self.editorGroupBox) self.addButton.setObjectName("addButton") self.variable_verticalLayout_2.addWidget(self.addButton) self.editButton = QPushButton(self.editorGroupBox) self.editButton.setObjectName("editButton") self.variable_verticalLayout_2.addWidget(self.editButton) self.removeButton = QPushButton(self.editorGroupBox) self.removeButton.setObjectName("removeButton") self.variable_verticalLayout_2.addWidget(self.removeButton) spacerItem = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) self.variable_verticalLayout_2.addItem(spacerItem) self.upButton = QPushButton(self.editorGroupBox) self.upButton.setObjectName("upButton") self.variable_verticalLayout_2.addWidget(self.upButton) self.downButton = QPushButton(self.editorGroupBox) self.downButton.setObjectName("downButton") self.variable_verticalLayout_2.addWidget(self.downButton) spacerItem1 = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) self.variable_verticalLayout_2.addItem(spacerItem1) self.variable_verticalLayout_2.setStretch(3, 1) self.variable_verticalLayout_2.setStretch(6, 1) self.gridLayout.addLayout(self.variable_verticalLayout_2, 0, 1, 1, 1) self.gridLayout.setColumnStretch(0, 1) self.gridLayout_3.addLayout(self.gridLayout, 0, 0, 1, 1) self.horizontalLayout = QHBoxLayout() self.horizontalLayout.setContentsMargins(15, 15, 15, 15) self.horizontalLayout.setObjectName("horizontalLayout") spacerItem2 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem2) self.ok_pushButton = QPushButton(self.editorGroupBox) self.ok_pushButton.setObjectName("ok_pushButton") self.horizontalLayout.addWidget(self.ok_pushButton) self.cancel_pushButton = QPushButton(self.editorGroupBox) self.cancel_pushButton.setObjectName("cancel_pushButton") self.horizontalLayout.addWidget(self.cancel_pushButton) self.horizontalLayout.setStretch(0, 1) self.gridLayout_3.addLayout(self.horizontalLayout, 1, 0, 1, 1) self.gridLayout_2.addWidget(self.editorGroupBox, 0, 0, 1, 1) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def __init__(self): ##### logger.info('Inside PurchaseSchedule') self.notificationTab_tab_4 = QWidget() self.notificationTab_tab_4.setObjectName("notificationTab_tab_4") self.gridLayout_19 = QGridLayout(self.notificationTab_tab_4) self.gridLayout_19.setObjectName("gridLayout_19") ## self.horizontalLayout = QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.title_label = QLabel(self.notificationTab_tab_4) self.title_label.setObjectName("title_label") self.horizontalLayout.addWidget(self.title_label) self.gridLayout_19.addLayout(self.horizontalLayout, 0, 0, 1, 1) ## self.horizontalLayout_6 = QHBoxLayout() self.horizontalLayout_6.setObjectName("horizontalLayout_6") self.id_label = QLabel(self.notificationTab_tab_4) self.id_label.setObjectName("id_label") self.horizontalLayout_6.addWidget(self.id_label) self.id_line = QLineEdit(self.notificationTab_tab_4) self.id_line.setObjectName("id_line") self.horizontalLayout_6.addWidget(self.id_line) self.notification_schedule_fromdate_label = QLabel( self.notificationTab_tab_4) self.notification_schedule_fromdate_label.setObjectName( "notification_schedule_fromdate_label") self.horizontalLayout_6.addWidget( self.notification_schedule_fromdate_label) self.notification_schedule_fromdate_dateedit = QDateEdit( self.notificationTab_tab_4) self.notification_schedule_fromdate_dateedit.setMaximumDate( QDate.currentDate()) self.notification_schedule_fromdate_dateedit.setDate( QDate.currentDate()) self.notification_schedule_fromdate_dateedit.setCalendarPopup(True) self.notification_schedule_fromdate_dateedit.setObjectName( "notification_schedule_fromdate_dateedit") self.horizontalLayout_6.addWidget( self.notification_schedule_fromdate_dateedit) self.notification_schedule_todate_label = QLabel( self.notificationTab_tab_4) self.notification_schedule_todate_label.setObjectName( "notification_schedule_todate_label") self.horizontalLayout_6.addWidget( self.notification_schedule_todate_label) self.notification_schedule_todate_dateedit = QDateEdit( self.notificationTab_tab_4) self.notification_schedule_todate_dateedit.setMaximumDate( QDate.currentDate()) self.notification_schedule_todate_dateedit.setDate(QDate.currentDate()) self.notification_schedule_todate_dateedit.setCalendarPopup(True) self.notification_schedule_todate_dateedit.setObjectName( "notification_schedule_todate_dateedit") self.horizontalLayout_6.addWidget( self.notification_schedule_todate_dateedit) self.type_label = QLabel(self.notificationTab_tab_4) self.type_label.setObjectName("type_label") self.horizontalLayout_6.addWidget(self.type_label) self.notification_states = QComboBox(self.notificationTab_tab_4) self.notification_states.setObjectName("notification_states") self.horizontalLayout_6.addWidget(self.notification_states) self.batch_label = QLabel(self.notificationTab_tab_4) self.batch_label.setObjectName("batch_label") self.horizontalLayout_6.addWidget(self.batch_label) self.notification_results = QComboBox(self.notificationTab_tab_4) self.notification_results.setObjectName("notification_results") self.horizontalLayout_6.addWidget(self.notification_results) self.gridLayout_19.addLayout(self.horizontalLayout_6, 1, 0, 1, 1) self.gridLayout_8 = QGridLayout() self.gridLayout_8.setObjectName("gridLayout_8") self.notification_schedule_table = QTableWidget( self.notificationTab_tab_4) self.notification_schedule_table.setObjectName( "notification_schedule_table") self.notification_schedule_table.setColumnCount(5) self.notification_schedule_table.setRowCount(0) self.notification_schedule_table.setWordWrap(True) item = QTableWidgetItem() self.notification_schedule_table.setHorizontalHeaderItem(0, item) item = QTableWidgetItem() self.notification_schedule_table.setHorizontalHeaderItem(1, item) item = QTableWidgetItem() self.notification_schedule_table.setHorizontalHeaderItem(2, item) item = QTableWidgetItem() self.notification_schedule_table.setHorizontalHeaderItem(3, item) item = QTableWidgetItem() self.notification_schedule_table.setHorizontalHeaderItem(4, item) self.notification_schedule_table.horizontalHeader( ).setCascadingSectionResizes(True) self.notification_schedule_table.horizontalHeader( ).setStretchLastSection(True) self.notification_schedule_table.verticalHeader().setVisible(False) self.notification_schedule_table.verticalHeader( ).setCascadingSectionResizes(True) self.notification_schedule_table.verticalHeader( ).setStretchLastSection(False) self.gridLayout_8.addWidget(self.notification_schedule_table, 0, 0, 1, 5) self.notification_search_button = QPushButton( self.notificationTab_tab_4) self.notification_search_button.setObjectName( "notification_search_button") self.gridLayout_8.addWidget(self.notification_search_button, 1, 0, 1, 1) spacerItem10 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.gridLayout_8.addItem(spacerItem10, 1, 2, 1, 1) self.notification_reset_button = QPushButton( self.notificationTab_tab_4) self.notification_reset_button.setObjectName( "notification_reset_button") self.gridLayout_8.addWidget(self.notification_reset_button, 1, 3, 1, 1) self.notification_load_more_button = QPushButton( self.notificationTab_tab_4) self.notification_load_more_button.setObjectName( "notification_load_more_button") self.gridLayout_8.addWidget(self.notification_load_more_button, 1, 4, 1, 1) self.gridLayout_19.addLayout(self.gridLayout_8, 2, 0, 1, 1) ###retranslate self.title_label.setText( QApplication.translate( "MainWindow", "<html><head/><body><p align=\"center\">" "<span style=\" font-weight:600;font-size:20px\">" "<u>All Notifications</u></span></p></body></html>", None, QApplication.UnicodeUTF8)) self.id_label.setText( QApplication.translate("MainWindow", "Message Id", None, QApplication.UnicodeUTF8)) self.notification_schedule_fromdate_label.setText( QApplication.translate("MainWindow", "From Date", None, QApplication.UnicodeUTF8)) self.notification_schedule_fromdate_dateedit.setDisplayFormat( QApplication.translate("MainWindow", "dd/MM/yyyy", None, QApplication.UnicodeUTF8)) self.notification_schedule_todate_label.setText( QApplication.translate("MainWindow", "To Date", None, QApplication.UnicodeUTF8)) self.notification_schedule_todate_dateedit.setDisplayFormat( QApplication.translate("MainWindow", "dd/MM/yyyy", None, QApplication.UnicodeUTF8)) self.type_label.setText( QApplication.translate("MainWindow", "Type", None, QApplication.UnicodeUTF8)) self.batch_label.setText( QApplication.translate("MainWindow", "Number of Notifications", None, QApplication.UnicodeUTF8)) self.notification_schedule_table.horizontalHeaderItem(0).setText( QApplication.translate("MainWindow", "Message Id", None, QApplication.UnicodeUTF8)) self.notification_schedule_table.horizontalHeaderItem(1).setText( QApplication.translate("MainWindow", "Date", None, QApplication.UnicodeUTF8)) self.notification_schedule_table.horizontalHeaderItem(2).setText( QApplication.translate("MainWindow", "From", None, QApplication.UnicodeUTF8)) self.notification_schedule_table.horizontalHeaderItem(3).setText( QApplication.translate("MainWindow", "Message", None, QApplication.UnicodeUTF8)) self.notification_schedule_table.horizontalHeaderItem(4).setText( QApplication.translate("MainWindow", "State", None, QApplication.UnicodeUTF8)) self.notification_search_button.setText( QApplication.translate("MainWindow", "Search", None, QApplication.UnicodeUTF8)) self.notification_reset_button.setText( QApplication.translate("MainWindow", "Reset All", None, QApplication.UnicodeUTF8)) self.notification_load_more_button.setText( QApplication.translate("MainWindow", "Load More", None, QApplication.UnicodeUTF8)) ##signals and slotts && other stuffs self.scheduletable_count = 0 self.addtable_count = 0 # self.mainwindow = Ui_MainWindow # just for the ease of finding the attributes in pycharm self.notification_schedule_table.setEditTriggers( QAbstractItemView.NoEditTriggers) self.batch_number = None self.notification_results.addItems([str(i) for i in range(1, 50, 5)]) self.notification_states.addItems(['All', 'New', 'To Do', 'Done']) self.message = Messaging() self.notification_load_more_button.clicked.connect(self.load_more) self.notification_search_button.clicked.connect(self.search_messages) self.notification_reset_button.clicked.connect(self.reset_all) self.notificationTab_tab_4.setFocusPolicy(Qt.StrongFocus) self.notificationTab_tab_4.focusInEvent = self.load_rows
def __init__(self, parent): super(TipOfTheDayDialog, self).__init__(parent) """Default class constructor.""" ## qDebug("TipOfTheDayDialog constructor") self.mainWin = parent self.setAttribute(Qt.WA_DeleteOnClose) self.setWizardStyle(QWizard.ModernStyle) self.setMinimumSize(550, 400) ## self.setOption(QWizard.HaveHelpButton, True) page = QWizardPage(self) self.imgBanner = ImageWidget(self.mainWin.gImgDir, self.mainWin.gIconDir, self) # Read in the tips.txt file. # fileOpen = open(self.mainWin.gAppDir + os.sep + 'tips.txt') # tips = fileOpen.read() # fileOpen.close() # self.tipsList = [tip for tip in tips.split('\n') if tip] # remove the blank lines also. self.tipsList = [tip for tip in TIPS_TXT.split('\n') if tip] # remove the blank lines also. # Make sure we don't cause an IndexError. # DEV-We might be adding tips to the txt at runtime. The easy way to add and check tips. if int(self.mainWin.settings_general_current_tip) >= len( self.tipsList): self.mainWin.settings_general_current_tip = 0 self.labelTipOfTheDay = QLabel(self) self.labelTipOfTheDay.setText(self.tipsList[int( self.mainWin.settings_general_current_tip)]) self.labelTipOfTheDay.setWordWrap(True) # Forget about a standardish QCheckBox, real powerusers keep the lights on! self.lightswitch = LightSwitchWidget(self.mainWin.gImgDir, self.mainWin, self) self.showOnStartupLabel = QLabel(self) self.showOnStartupLabel.setText(self.tr('Show tips on startup')) layout = QVBoxLayout(self) hblayout = QHBoxLayout() hblayout2 = QHBoxLayout() hblayout.addStretch(1) hblayout.addWidget(self.imgBanner) hblayout.addStretch(1) layout.addLayout(hblayout) layout.addStrut(1) layout.addSpacerItem(QSpacerItem(0, 5)) layout.addWidget(self.labelTipOfTheDay) layout.addStretch(1) hblayout2.addWidget(self.lightswitch) hblayout2.addWidget(self.showOnStartupLabel) hblayout2.addStretch(1) self.showOnStartupLabel.setAlignment(Qt.AlignBottom) layout.addLayout(hblayout2) page.setLayout(layout) self.addPage(page) self.setWindowTitle(self.tr('Tip of the Day')) buttonPrevious = QPushButton(self) buttonPrevious.setText(self.tr('&Previous')) buttonPrevious.setIcon( QIcon(self.mainWin.gIconDir + os.sep + 'undo.png')) buttonPrevious.setIconSize(QSize(24, 24)) buttonNext = QPushButton(self) buttonNext.setText(self.tr('&Next')) buttonNext.setIcon(QIcon(self.mainWin.gIconDir + os.sep + 'redo.png')) buttonNext.setIconSize(QSize(24, 24)) buttonClose = QPushButton(self) buttonClose.setText(self.tr('&Close')) buttonClose.setIcon( QIcon(self.mainWin.gIconDir + os.sep + 'windowclose.png')) buttonClose.setIconSize(QSize(24, 24)) self.setButton(QWizard.CustomButton1, buttonPrevious) self.setButton(QWizard.CustomButton2, buttonNext) self.setButton(QWizard.CustomButton3, buttonClose) self.setOption(QWizard.HaveCustomButton1, True) self.setOption(QWizard.HaveCustomButton2, True) self.setOption(QWizard.HaveCustomButton3, True) self.customButtonClicked.connect(self.buttonTipOfTheDayClicked) listTipOfTheDayButtons = [ QWizard.Stretch, QWizard.CustomButton1, QWizard.CustomButton2, QWizard.CustomButton3 ] self.setButtonLayout(listTipOfTheDayButtons) self.DoSetWhatsThis()
def __init__(self): ### logger.info('Inside WasteDish') self.wastedetail_tab_1 = QWidget() self.wastedetail_tab_1.setObjectName("wastedetail_tab_1") self.verticalLayout_9 = QVBoxLayout(self.wastedetail_tab_1) self.verticalLayout_9.setObjectName("verticalLayout_9") self.verticalLayout_8 = QVBoxLayout() self.verticalLayout_8.setObjectName("verticalLayout_8") self.horizontalLayout_12 = QHBoxLayout() self.horizontalLayout_12.setObjectName("horizontalLayout_12") self.waste_fromdate_label = QLabel(self.wastedetail_tab_1) self.waste_fromdate_label.setObjectName('waste_fromdate_label') self.horizontalLayout_12.addWidget(self.waste_fromdate_label) self.waste_fromdate_dateedit = QDateEdit(self.wastedetail_tab_1) self.waste_fromdate_dateedit.setCalendarPopup(True) self.waste_fromdate_dateedit.setObjectName("waste_fromdate_dateedit") self.horizontalLayout_12.addWidget(self.waste_fromdate_dateedit) self.waste_todate_label = QLabel(self.wastedetail_tab_1) self.waste_todate_label.setObjectName('waste_todate_label') self.horizontalLayout_12.addWidget(self.waste_todate_label) self.waste_todate_dateedit = QDateEdit(self.wastedetail_tab_1) self.waste_todate_dateedit.setCalendarPopup(True) self.waste_todate_dateedit.setObjectName("waste_todate_dateedit") self.waste_todate_dateedit.setMaximumDate(QDate.currentDate()) self.horizontalLayout_12.addWidget(self.waste_todate_dateedit) spacerItem28 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout_12.addItem(spacerItem28) self.waste_table_search_button = QPushButton(self.wastedetail_tab_1) self.waste_table_search_button.setObjectName( "waste_table_search_button") self.horizontalLayout_12.addWidget(self.waste_table_search_button) self.verticalLayout_8.addLayout(self.horizontalLayout_12) self.waste_table = QTableWidget(self.wastedetail_tab_1) self.waste_table.setObjectName("waste_table") self.waste_table.setColumnCount(5) self.waste_table.setRowCount(0) item = QTableWidgetItem() self.waste_table.setHorizontalHeaderItem(0, item) item = QTableWidgetItem() self.waste_table.setHorizontalHeaderItem(1, item) item = QTableWidgetItem() self.waste_table.setHorizontalHeaderItem(2, item) item = QTableWidgetItem() self.waste_table.setHorizontalHeaderItem(3, item) item = QTableWidgetItem() self.waste_table.setHorizontalHeaderItem(4, item) self.waste_table.horizontalHeader().setCascadingSectionResizes(False) self.waste_table.horizontalHeader().setStretchLastSection(True) self.waste_table.verticalHeader().setVisible(False) self.waste_table.verticalHeader().setCascadingSectionResizes(False) self.waste_table.setSortingEnabled(True) self.verticalLayout_8.addWidget(self.waste_table) self.horizontalLayout_13 = QHBoxLayout() self.horizontalLayout_13.setObjectName("horizontalLayout_13") self.waste_table_newrow_button = QPushButton(self.wastedetail_tab_1) self.waste_table_newrow_button.setObjectName( "waste_table_newrow_button") self.horizontalLayout_13.addWidget(self.waste_table_newrow_button) spacerItem29 = QSpacerItem(612, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout_13.addItem(spacerItem29) self.waste_table_discard_button = QPushButton(self.wastedetail_tab_1) self.waste_table_discard_button.setObjectName( "waste_table_discard_button") self.horizontalLayout_13.addWidget(self.waste_table_discard_button) self.verticalLayout_8.addLayout(self.horizontalLayout_13) self.verticalLayout_9.addLayout(self.verticalLayout_8) ##retranslate self.waste_fromdate_label.setText( QApplication.translate("MainWindow", "From Date", None, QApplication.UnicodeUTF8)) self.waste_fromdate_dateedit.setDisplayFormat( QApplication.translate("MainWindow", "dd/MM/yyyy", None, QApplication.UnicodeUTF8)) self.waste_todate_label.setText( QApplication.translate("MainWindow", "To Date", None, QApplication.UnicodeUTF8)) self.waste_todate_dateedit.setDisplayFormat( QApplication.translate("MainWindow", "dd/MM/yyyy", None, QApplication.UnicodeUTF8)) self.waste_table_search_button.setText( QApplication.translate("MainWindow", "Search", None, QApplication.UnicodeUTF8)) self.waste_table.horizontalHeaderItem(0).setText( QApplication.translate("MainWindow", "Code", None, QApplication.UnicodeUTF8)) self.waste_table.horizontalHeaderItem(1).setText( QApplication.translate("MainWindow", "Item", None, QApplication.UnicodeUTF8)) self.waste_table.horizontalHeaderItem(2).setText( QApplication.translate("MainWindow", "Category", None, QApplication.UnicodeUTF8)) self.waste_table.horizontalHeaderItem(3).setText( QApplication.translate("MainWindow", "Quantity", None, QApplication.UnicodeUTF8)) self.waste_table.horizontalHeaderItem(4).setText( QApplication.translate("MainWindow", "Reason", None, QApplication.UnicodeUTF8)) self.waste_table_newrow_button.setText( QApplication.translate("MainWindow", "New Row", None, QApplication.UnicodeUTF8)) self.waste_table_discard_button.setText( QApplication.translate("MainWindow", "Discard Item", None, QApplication.UnicodeUTF8)) self.wastedetail_tab_1.setTabOrder(self.waste_fromdate_dateedit, self.waste_todate_dateedit) self.wastedetail_tab_1.setTabOrder(self.waste_todate_dateedit, self.waste_table_search_button) ###signals and slots && other stuffs # self.mainwindow = Ui_MainWindow # just for the ease of finding the attributes in pycharm self.schedule = SchedulePurchase() self.suplier = BusinessParty(category='Supplier') self.add = AddStockInventory() self.item = WasteMenu() self.waste_fromdate_dateedit.setDate(QDate.currentDate()) self.waste_todate_dateedit.setDate(QDate.currentDate()) self.waste_table.setEditTriggers(QAbstractItemView.NoEditTriggers) self.waste_table_newrow_button.clicked.connect(self.add_new_blank_rows) self.waste_table_discard_button.clicked.connect(self.discard) self.waste_table_search_button.clicked.connect(self.search_discard) self.wastedetail_tab_1.setFocusPolicy(Qt.StrongFocus) self.wastedetail_tab_1.focusInEvent = self.load_rows
def setupUi(self, editTeamDialog): editTeamDialog.setObjectName("editTeamDialog") editTeamDialog.setMinimumSize(QSize(500, 550)) editTeamDialog.setMaximumSize(QSize(500, 550)) self.mainVerticalLayout = QVBoxLayout(editTeamDialog) self.topLayout = QHBoxLayout() self.teamUserInfoLayout = QGridLayout() managerLabel = QLabel() self.teamUserInfoLayout.addWidget(managerLabel, 0, 0) teamLabel = QLabel() self.teamUserInfoLayout.addWidget(teamLabel, 1, 0) self.teamNameEdit = QLineEdit() self.teamNameEdit.setMinimumWidth(200) self.teamUserInfoLayout.addWidget(self.teamNameEdit, 1, 1) emailLabel = QLabel() self.teamUserInfoLayout.addWidget(emailLabel, 2, 0) self.emailEdit = QLineEdit() self.teamUserInfoLayout.addWidget(self.emailEdit, 2, 1) self.topLayout.addLayout(self.teamUserInfoLayout) self.topLayout.addStretch() self.mainVerticalLayout.addLayout(self.topLayout) self.mainVerticalLayout.addItem(QSpacerItem(0, 15)) #self.mainVerticalLayout.addStretch() self.formationLayout = QHBoxLayout() self.formationRadioButtons = RadioButtonGroup("Formation", Formation.formations) self.formationRadioButtons.setFlat(True) self.formationLayout.addWidget(self.formationRadioButtons) self.formationLayout.addStretch() self.mainVerticalLayout.addLayout(self.formationLayout) self.playersGroupBox = QGroupBox() self.gridLayout = QGridLayout(self.playersGroupBox) self.goalkeeperLabel = QLabel(self.playersGroupBox) self.gridLayout.addWidget(self.goalkeeperLabel, 0, 0) self.positionLabels = [QLabel(self.playersGroupBox) for i in range(11)] self.searchBoxes = [QLineEdit(self.playersGroupBox) for i in range(11)] self.selections = [QComboBox(self.playersGroupBox) for i in range(11)] self.clubLabels = [QLabel(self.playersGroupBox) for i in range(11)] self.valueLabels = [QLabel(self.playersGroupBox) for i in range(11)] for i, positionLabel in enumerate(self.positionLabels): self.gridLayout.addWidget(positionLabel, i, 0) for i, searchBox in enumerate(self.searchBoxes): searchBox.setToolTip("Search for a player by code or name") self.gridLayout.addWidget(searchBox, i, 1) searchBox.returnPressed.connect(partial(self.playerSearch, i)) for i, selection in enumerate(self.selections): selection.setToolTip("Select a player") selection.setSizeAdjustPolicy( QComboBox.AdjustToContentsOnFirstShow) selection.setCurrentIndex(-1) self.gridLayout.addWidget(selection, i, 2) clubWidth = self.clubLabels[0].fontMetrics().width( "Wolverhampton Wanderers") for i, clubLabel in enumerate(self.clubLabels): clubLabel.setFixedWidth(clubWidth) self.gridLayout.addWidget(clubLabel, i, 3) valueWidth = self.valueLabels[0].fontMetrics().width("0.0") for i, valueLabel in enumerate(self.valueLabels): valueLabel.setFixedWidth(valueWidth) self.gridLayout.addWidget(valueLabel, i, 4) self.mainVerticalLayout.addWidget(self.playersGroupBox) self.mainVerticalLayout.addItem(QSpacerItem(0, 15)) self.totalCostLayout = QHBoxLayout() self.totalCostLabel = QLabel() self.totalCostLayout.addWidget(self.totalCostLabel) self.mainVerticalLayout.addLayout(self.totalCostLayout) self.mainVerticalLayout.addItem(QSpacerItem(0, 15)) self.buttonLayout = QHBoxLayout() okButton = QPushButton("OK") okButton.setAutoDefault(False) cancelButton = QPushButton("Cancel") cancelButton.setAutoDefault(False) self.buttonLayout.addWidget(okButton) self.buttonLayout.addWidget(cancelButton) buttonSpacer = QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum) self.buttonLayout.addItem(buttonSpacer) self.mainVerticalLayout.addLayout(self.buttonLayout) okButton.clicked.connect(editTeamDialog.accept) cancelButton.clicked.connect(editTeamDialog.reject) managerLabel.setText("Manager") teamLabel.setText("Team Name") emailLabel.setText("Email") self.playersGroupBox.setTitle("Players") for formationRadioButton in self.formationRadioButtons: formationRadioButton.clicked.connect( partial(self.formationChanged, str(formationRadioButton.text()))) self.totalCostLabel.setText("Total Cost")
def __init__(self, day): #### logger.info('Inside MenuWeekday') self.menudetail_tab_1 = QWidget() self.menudetail_tab_1.setObjectName("menudetail_tab_1") self.gridLayout_20 = QGridLayout(self.menudetail_tab_1) self.gridLayout_20.setObjectName("gridLayout_20") self.menu_table = QTableWidget(self.menudetail_tab_1) self.menu_table.setSortingEnabled(True) self.menu_table.setObjectName("menu_table") self.menu_table.setColumnCount(6) self.menu_table.setRowCount(0) item = QTableWidgetItem() self.menu_table.setHorizontalHeaderItem(0, item) item = QTableWidgetItem() self.menu_table.setHorizontalHeaderItem(1, item) item = QTableWidgetItem() self.menu_table.setHorizontalHeaderItem(2, item) item = QTableWidgetItem() self.menu_table.setHorizontalHeaderItem(3, item) item = QTableWidgetItem() self.menu_table.setHorizontalHeaderItem(4, item) item = QTableWidgetItem() self.menu_table.setHorizontalHeaderItem(5, item) self.menu_table.horizontalHeader().setCascadingSectionResizes(False) self.menu_table.horizontalHeader().setStretchLastSection(True) self.menu_table.verticalHeader().setVisible(True) self.menu_table.verticalHeader().setCascadingSectionResizes(True) self.gridLayout_20.addWidget(self.menu_table, 0, 0, 1, 3) spacerItem22 = QSpacerItem(612, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.gridLayout_20.addItem(spacerItem22, 1, 0, 1, 1) self.menu_table_refresh_button = QPushButton(self.menudetail_tab_1) self.menu_table_refresh_button.setObjectName("menu_table_refresh_button") self.gridLayout_20.addWidget(self.menu_table_refresh_button, 1, 1, 1, 1) self.menu_table_add_button = QPushButton(self.menudetail_tab_1) self.menu_table_add_button.setObjectName("menu_table_add_button") self.gridLayout_20.addWidget(self.menu_table_add_button, 1, 2, 1, 1) ####retranslate self.menu_table.horizontalHeaderItem(0).setText( QApplication.translate("MainWindow", "Code", None, QApplication.UnicodeUTF8)) self.menu_table.horizontalHeaderItem(1).setText( QApplication.translate("MainWindow", "Item", None, QApplication.UnicodeUTF8)) self.menu_table.horizontalHeaderItem(2).setText( QApplication.translate("MainWindow", "Category", None, QApplication.UnicodeUTF8)) self.menu_table.horizontalHeaderItem(3).setText( QApplication.translate("MainWindow", "Rate", None, QApplication.UnicodeUTF8)) self.menu_table.horizontalHeaderItem(4).setText( QApplication.translate("MainWindow", "Per Day", None, QApplication.UnicodeUTF8)) self.menu_table.horizontalHeaderItem(5).setText( QApplication.translate("MainWindow", "Available", None, QApplication.UnicodeUTF8)) self.menu_table_refresh_button.setText( QApplication.translate("MainWindow", "Refresh", None, QApplication.UnicodeUTF8)) self.menu_table_add_button.setText( QApplication.translate("MainWindow", "Add Dish", None, QApplication.UnicodeUTF8)) ###signals and slots && other stuffs # self.mainwindow = Ui_MainWindow # just for the ease of finding the attributes in pycharm self.day = day self.menu_table_add_button.clicked.connect(self.add_menu) self.menu_table.itemDoubleClicked.connect(self.popup_edit) self.menu_table_refresh_button.clicked.connect(self.update_menu) self.menu_table.setSelectionBehavior(QAbstractItemView.SelectRows) self.menu_table.setEditTriggers(QAbstractItemView.NoEditTriggers) self.menu_table.setShowGrid(False) self.menu_table.setAlternatingRowColors(True) self.update_menu() self.popup = object self.menudetail_tab_1.setFocusPolicy(Qt.StrongFocus) self.menudetail_tab_1.focusInEvent = self.load_rows self.assign_shortcuts()
def setup(self): """initializes the uio of the erp client""" self.progress.setFixedWidth(1000) self.progress.setCancelButton(None) # self.progress.setWindowModality(Qt.WindowModal) self.progress.setValue(1) self.mainwindow.setObjectName("MainWindow") self.mainwindow.resize(832, 668) self.mainwindow.setStyleSheet( "QToolBar{\n" "background: qlineargradient(x1:0, y1:0, x2:1, y2:1,\n" "stop:0 rgba(0,0,0),stop:1 rgb(162, 162, 162, 162));\n" "border: 0px;\n" "}\n" "QToolBar > QWidget{\n" "color:white;\n" "}\n" "QToolBar > QWidget:hover {\n" "background:transparent;\n" " }\n" "QToolBar > QWidget:checked {\n" "background:transparent;\n" " }\n" "#MainWindow{\n" "background: qlineargradient(x1:0, y1:0, x2:1, y2:1,\n" "stop:0 rgba(0,0,0),stop:1 rgb(162, 162, 162, 162));\n" "border: 0px;\n" "}\n" "") self.centralWidget = QWidget(self.mainwindow) self.centralWidget.setObjectName("centralWidget") self.gridLayout_2 = QGridLayout(self.centralWidget) self.gridLayout_2.setObjectName("gridLayout_2") self.stackedWidget = QStackedWidget(self.centralWidget) self.stackedWidget.setStyleSheet("") self.stackedWidget.setObjectName("stackedWidget") self.shortcut = NewShortcut() scroll = QScrollArea() scroll.setWidget(self.shortcut.shortcut_setting) self.stackedWidget.addWidget(self.shortcut.shortcut_setting) self.home_page = QWidget() self.home_page.setObjectName("home_page") self.gridLayout = QGridLayout(self.home_page) self.gridLayout.setObjectName("gridLayout") self.billing_frame_2 = QFrame(self.home_page) self.billing_frame_2.setStyleSheet( "background-image:url(:/images/billing_frame.png);\n" "background-repeat: no-repeat;\n" "background-position: center;\n" "background-color:#6CBED2;") self.billing_frame_2.setFrameShape(QFrame.StyledPanel) self.billing_frame_2.setFrameShadow(QFrame.Raised) self.billing_frame_2.setObjectName("billing_frame_2") self.verticalLayout_4 = QVBoxLayout(self.billing_frame_2) self.verticalLayout_4.setObjectName("verticalLayout_4") spacerItem = QSpacerItem(20, 217, QSizePolicy.Minimum, QSizePolicy.Expanding) self.verticalLayout_4.addItem(spacerItem) self.label_10 = QLabel(self.billing_frame_2) self.label_10.setStyleSheet("background:transparent;") self.label_10.setObjectName("label_10") self.verticalLayout_4.addWidget(self.label_10) self.gridLayout.addWidget(self.billing_frame_2, 0, 1, 1, 1) self.employee_frame_3 = QFrame(self.home_page) self.employee_frame_3.setStyleSheet( "background-image:url(:/images/employee_frame.png);\n" "background-repeat: no-repeat;\n" "background-position: center;\n" "background-color:#0099CC;") self.employee_frame_3.setFrameShape(QFrame.StyledPanel) self.employee_frame_3.setFrameShadow(QFrame.Raised) self.employee_frame_3.setObjectName("employee_frame_3") self.verticalLayout_5 = QVBoxLayout(self.employee_frame_3) self.verticalLayout_5.setObjectName("verticalLayout_5") spacerItem1 = QSpacerItem(20, 217, QSizePolicy.Minimum, QSizePolicy.Expanding) self.verticalLayout_5.addItem(spacerItem1) self.label_11 = QLabel(self.employee_frame_3) self.label_11.setStyleSheet("background:transparent;") self.label_11.setObjectName("label_11") self.verticalLayout_5.addWidget(self.label_11) self.gridLayout.addWidget(self.employee_frame_3, 0, 2, 1, 1) self.menu_frame_4 = QFrame(self.home_page) self.menu_frame_4.setStyleSheet( "background-image:url(:/images/menu_frame.png);\n" "background-repeat: no-repeat;\n" "background-position: center;\n" "background-color:#297ACC;") self.menu_frame_4.setFrameShape(QFrame.StyledPanel) self.menu_frame_4.setFrameShadow(QFrame.Raised) self.menu_frame_4.setObjectName("menu_frame_4") self.verticalLayout_3 = QVBoxLayout(self.menu_frame_4) self.verticalLayout_3.setObjectName("verticalLayout_3") spacerItem2 = QSpacerItem(20, 216, QSizePolicy.Minimum, QSizePolicy.Expanding) self.verticalLayout_3.addItem(spacerItem2) self.label_12 = QLabel(self.menu_frame_4) self.label_12.setStyleSheet("background:transparent;") self.label_12.setObjectName("label_12") self.verticalLayout_3.addWidget(self.label_12) self.gridLayout.addWidget(self.menu_frame_4, 1, 0, 1, 1) self.report_frame_5 = QFrame(self.home_page) self.report_frame_5.setStyleSheet( "background-image:url(:/images/report_frame.png);\n" "background-repeat: no-repeat;\n" "background-position: center;\n" "background-color:#006BB2;") self.report_frame_5.setFrameShape(QFrame.StyledPanel) self.report_frame_5.setFrameShadow(QFrame.Raised) self.report_frame_5.setObjectName("report_frame_5") self.verticalLayout_6 = QVBoxLayout(self.report_frame_5) self.verticalLayout_6.setObjectName("verticalLayout_6") spacerItem3 = QSpacerItem(20, 216, QSizePolicy.Minimum, QSizePolicy.Expanding) self.verticalLayout_6.addItem(spacerItem3) self.label_13 = QLabel(self.report_frame_5) self.label_13.setStyleSheet("background:transparent;") self.label_13.setObjectName("label_13") self.verticalLayout_6.addWidget(self.label_13) self.gridLayout.addWidget(self.report_frame_5, 1, 1, 1, 1) self.waste_frame_6 = QFrame(self.home_page) self.waste_frame_6.setStyleSheet( "background-image:url(:/images/waste_frame.png);\n" "background-repeat: no-repeat;\n" "background-position: center;\n" "background-color:#003D7A;") self.waste_frame_6.setFrameShape(QFrame.StyledPanel) self.waste_frame_6.setFrameShadow(QFrame.Raised) self.waste_frame_6.setObjectName("waste_frame_6") self.verticalLayout_7 = QVBoxLayout(self.waste_frame_6) self.verticalLayout_7.setObjectName("verticalLayout_7") spacerItem4 = QSpacerItem(20, 216, QSizePolicy.Minimum, QSizePolicy.Expanding) self.verticalLayout_7.addItem(spacerItem4) self.label_14 = QLabel(self.waste_frame_6) self.label_14.setStyleSheet("background:transparent;") self.label_14.setObjectName("label_14") self.verticalLayout_7.addWidget(self.label_14) self.gridLayout.addWidget(self.waste_frame_6, 1, 2, 1, 1) self.inventory_frame_1 = QFrame(self.home_page) self.inventory_frame_1.setStyleSheet( "background-image:url(:/images/inventory_frame.png);\n" "background-repeat: no-repeat;\n" "background-position: center;\n" "background-color:#ADEBFF;") self.inventory_frame_1.setFrameShape(QFrame.StyledPanel) self.inventory_frame_1.setFrameShadow(QFrame.Raised) self.inventory_frame_1.setObjectName("inventory_frame_1") self.verticalLayout_2 = QVBoxLayout(self.inventory_frame_1) self.verticalLayout_2.setObjectName("verticalLayout_2") spacerItem5 = QSpacerItem(20, 217, QSizePolicy.Minimum, QSizePolicy.Expanding) self.verticalLayout_2.addItem(spacerItem5) self.label_9 = QLabel(self.inventory_frame_1) self.label_9.setStyleSheet("background:transparent;") self.label_9.setObjectName("label_9") self.verticalLayout_2.addWidget(self.label_9) self.gridLayout.addWidget(self.inventory_frame_1, 0, 0, 1, 1) self.stackedWidget.addWidget(self.home_page) self.detail_page = QWidget() self.detail_page.setObjectName("detail_page") self.horizontalLayout_2 = QHBoxLayout(self.detail_page) self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.main_tabWidget = QTabWidget(self.detail_page) self.main_tabWidget.setAutoFillBackground(False) self.main_tabWidget.setStyleSheet("") self.main_tabWidget.setTabPosition(QTabWidget.West) self.main_tabWidget.setIconSize(QSize(60, 60)) self.main_tabWidget.setElideMode(Qt.ElideNone) self.main_tabWidget.setObjectName("main_tabWidget") ##initializes the tabs self.add_tabs() self.main_tabWidget.setFocusPolicy(Qt.StrongFocus) self.main_tabWidget.focusInEvent = self.change_focus self.main_tabWidget.currentChanged.connect(self.change_focus) self.stackedWidget.currentChanged.connect(self.change_focus) ###### self.horizontalLayout_2.addWidget(self.main_tabWidget) self.stackedWidget.addWidget(self.detail_page) if ('Admin', True) in self.access: self.stackedWidget.addWidget(Admin(self.mainwindow)) notification = NotificationTab() tab = notification.notificationTab_tab_4 tab.custom_class_object = notification # class_object is used to access the api through the self.stackedWidget.addWidget(tab) self.gridLayout_2.addWidget(self.stackedWidget, 0, 0, 1, 1) self.mainwindow.setCentralWidget(self.centralWidget) self.menuBar = QMenuBar(self.mainwindow) self.menuBar.setGeometry(QRect(0, 0, 832, 29)) self.menuBar.setObjectName("menuBar") self.mainwindow.setMenuBar(self.menuBar) self.mainToolBar = QToolBar(self.mainwindow) self.mainToolBar.setLayoutDirection(Qt.RightToLeft) self.mainToolBar.setStyleSheet("") self.mainToolBar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) self.mainToolBar.setObjectName("mainToolBar") self.mainwindow.addToolBar(Qt.TopToolBarArea, self.mainToolBar) self.statusBar = QStatusBar(self.mainwindow) self.statusBar.setObjectName("statusBar") self.mainwindow.setStatusBar(self.statusBar) self.toolBar = QToolBar(self.mainwindow) self.toolBar.setLayoutDirection(Qt.RightToLeft) self.toolBar.setStyleSheet("") self.toolBar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) self.toolBar.setObjectName("toolBar") self.mainwindow.addToolBar(Qt.TopToolBarArea, self.toolBar) self.actionNotification = QAction(self.mainwindow) self.actionNotification.setCheckable(True) self.actionNotification.setChecked(False) self.actionNotification.setEnabled(True) icon6 = QIcon() icon6.addPixmap(QPixmap(":/images/notification.png"), QIcon.Normal, QIcon.Off) self.actionNotification.setIcon(icon6) self.actionNotification.setAutoRepeat(True) self.actionNotification.setVisible(True) self.actionNotification.setIconVisibleInMenu(False) self.actionNotification.setObjectName("actionNotification") self.actionNotification self.actionAdmin = QAction(self.mainwindow) # self.actionAdmin.setCheckable(True) icon7 = QIcon() icon7.addPixmap(QPixmap(":/images/admin.png"), QIcon.Normal, QIcon.Off) self.actionAdmin.setIcon(icon7) self.actionAdmin.setObjectName("actionAdmin") self.actionRefresh = QAction(self.mainwindow) icon8 = QIcon() icon8.addPixmap(QPixmap(":/images/refresh.png"), QIcon.Normal, QIcon.Off) self.actionRefresh.setIcon(icon8) self.actionRefresh.setObjectName("actionRefresh") self.actionHome = QAction(self.mainwindow) # self.actionHome.setCheckable(True) icon9 = QIcon() icon9.addPixmap(QPixmap(":/images/home.png"), QIcon.Normal, QIcon.Off) self.actionHome.setIcon(icon9) self.actionHome.setObjectName("actionHome") self.actionSettings = QAction(self.mainwindow) icon10 = QIcon() icon10.addPixmap(QPixmap(":/images/settings.png"), QIcon.Normal, QIcon.Off) self.actionSettings.setIcon(icon10) self.actionSettings.setObjectName("actionRefresh") self.toolBar.addAction(self.actionNotification) self.toolBar.addSeparator() self.toolBar.addAction(self.actionAdmin) if ('Admin', True) in self.access: self.toolBar.addSeparator() else: self.actionAdmin.setVisible(False) self.toolBar.addAction(self.actionHome) self.toolBar.addSeparator() self.toolBar.addAction(self.actionRefresh) self.toolBar.addSeparator() self.toolBar.addAction(self.actionSettings) ##retranslates self.mainwindow.setWindowTitle( QApplication.translate("MainWindow", settings.company, None, QApplication.UnicodeUTF8)) self.label_10.setText( QApplication.translate( "MainWindow", "<html><head/><body><p align=\"center\">BILLING</p></body></html>", None, QApplication.UnicodeUTF8)) self.label_11.setText( QApplication.translate( "MainWindow", "<html><head/><body><p align=\"center\">EMPLOYEE</p></body></html>", None, QApplication.UnicodeUTF8)) self.label_12.setText( QApplication.translate( "MainWindow", "<html><head/><body><p align=\"center\">MENU</p></body></html>", None, QApplication.UnicodeUTF8)) self.label_13.setText( QApplication.translate( "MainWindow", "<html><head/><body><p align=\"center\">REPORT</p></body></html>", None, QApplication.UnicodeUTF8)) self.label_14.setText( QApplication.translate( "MainWindow", "<html><head/><body><p align=\"center\">WASTE</p></body></html>", None, QApplication.UnicodeUTF8)) self.label_9.setText( QApplication.translate( "MainWindow", "<html><head/><body><p align=\"center\">INVENTORY</p></body></html>", None, QApplication.UnicodeUTF8)) self.inventory_frame_1.setToolTip( QApplication.translate("MainWindow", "Go to the Inventory Tab", None, QApplication.UnicodeUTF8)) self.billing_frame_2.setToolTip( QApplication.translate("MainWindow", "Go to the Billing Tab", None, QApplication.UnicodeUTF8)) self.employee_frame_3.setToolTip( QApplication.translate("MainWindow", "Go to the Employee Tab", None, QApplication.UnicodeUTF8)) self.menu_frame_4.setToolTip( QApplication.translate("MainWindow", "Go to the Menu Tab", None, QApplication.UnicodeUTF8)) self.report_frame_5.setToolTip( QApplication.translate("MainWindow", "Go to the Report Tab", None, QApplication.UnicodeUTF8)) self.waste_frame_6.setToolTip( QApplication.translate("MainWindow", "Go to the Waste Tab", None, QApplication.UnicodeUTF8)) self.toolBar.setWindowTitle( QApplication.translate("MainWindow", "toolBar", None, QApplication.UnicodeUTF8)) self.actionNotification.setText("&&Notification") # QApplication.translate("MainWindow", "&Notification", None, QApplication.UnicodeUTF8)) self.actionNotification.setToolTip( QApplication.translate("MainWindow", "Click to see new notifications", None, QApplication.UnicodeUTF8)) # self.actionNotification.setShortcut( # QApplication.translate("MainWindow", "Ctrl+Shift+N", None, QApplication.UnicodeUTF8)) self.actionAdmin.setText('&&Admin') # QApplication.translate("MainWindow", "Admin", None, QApplication.UnicodeUTF8)) self.actionAdmin.setToolTip( QApplication.translate("MainWindow", "Click to go to admin interface", None, QApplication.UnicodeUTF8)) # self.actionAdmin.setShortcut( # QApplication.translate("MainWindow", "Ctrl+Shift+A", None, QApplication.UnicodeUTF8)) self.actionRefresh.setText("&&Refresh") # QApplication.translate("MainWindow", "Refresh", None, QApplication.UnicodeUTF8)) self.actionRefresh.setToolTip( QApplication.translate("MainWindow", "refreshes the data from the server", None, QApplication.UnicodeUTF8)) # self.actionRefresh.setShortcut( # QApplication.translate("MainWindow", "Ctrl+Shift+R", None, QApplication.UnicodeUTF8)) self.actionHome.setText('&&Home') # QApplication.translate("MainWindow", "Home", None, QApplication.UnicodeUTF8)) self.actionHome.setToolTip( QApplication.translate("MainWindow", "Go back to the home screen", None, QApplication.UnicodeUTF8)) self.actionSettings.setText('&&Settings') # QApplication.translate("MainWindow", "Settings", None, QApplication.UnicodeUTF8)) self.actionSettings.setToolTip( QApplication.translate("MainWindow", "Go to the settings panel", None, QApplication.UnicodeUTF8)) # self.actionHome.setShortcut( # QApplication.translate("MainWindow", "Ctrl+Shift+H", None, QApplication.UnicodeUTF8)) self.stackedWidget.setCurrentIndex(1) self.main_tabWidget.setCurrentIndex(0) self.ob = self.main_tabWidget.tabBar() # self.add_tool_tip(self.ob) todo avoided due to segmentation fault error, left for future fixes self.tb = EventHandlerForTabBar() self.ob.installEventFilter(self.tb) QMetaObject.connectSlotsByName(self.mainwindow)
def __init__(self, code=None, parent=None): logger.info('Inside ReportEmployeeTestDialogue') super(ReportEmployeeTestDialogue, self).__init__(parent) self.resize(500, 500) self.vertical_23 = QVBoxLayout(self) self.vertical_23.setObjectName("vertical_23") self.label_1 = QLabel(self) self.vertical_23.addWidget(self.label_1) self.report_health_table = QTableWidget(self) self.report_health_table.setObjectName("report_health_table") self.report_health_table.setColumnCount(5) self.report_health_table.setRowCount(0) self.report_health_table.setSelectionBehavior( QAbstractItemView.SelectRows) item = QTableWidgetItem() self.report_health_table.setHorizontalHeaderItem(0, item) item = QTableWidgetItem() self.report_health_table.setHorizontalHeaderItem(1, item) item = QTableWidgetItem() self.report_health_table.setHorizontalHeaderItem(2, item) item = QTableWidgetItem() self.report_health_table.setHorizontalHeaderItem(3, item) item = QTableWidgetItem() self.report_health_table.setHorizontalHeaderItem(4, item) self.report_health_table.horizontalHeader().setCascadingSectionResizes( True) self.report_health_table.horizontalHeader().setStretchLastSection(True) self.report_health_table.verticalHeader().setCascadingSectionResizes( True) self.vertical_23.addWidget(self.report_health_table) self.horizontal_21 = QHBoxLayout() self.report_health_newrow_buttuon = QPushButton(self) self.report_health_newrow_buttuon.setObjectName( "report_health_newrow_buttuon") self.horizontal_21.addWidget(self.report_health_newrow_buttuon) spacerItem23 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontal_21.addItem(spacerItem23) self.vertical_23.addLayout(self.horizontal_21) ### retanslate self.setWindowTitle( QApplication.translate("MainWindow", "Health Report", None, QApplication.UnicodeUTF8)) self.label_1.setText( QApplication.translate("MainWindow", "Health Report", None, QApplication.UnicodeUTF8)) self.report_health_table.horizontalHeaderItem(0).setText( QApplication.translate("MainWindow", "Code", None, QApplication.UnicodeUTF8)) self.report_health_table.horizontalHeaderItem(1).setText( QApplication.translate("MainWindow", "Date", None, QApplication.UnicodeUTF8)) self.report_health_table.horizontalHeaderItem(2).setText( QApplication.translate("MainWindow", "Organization Name", None, QApplication.UnicodeUTF8)) self.report_health_table.horizontalHeaderItem(3).setText( QApplication.translate("MainWindow", "Test", None, QApplication.UnicodeUTF8)) self.report_health_table.horizontalHeaderItem(4).setText( QApplication.translate("MainWindow", "Description", None, QApplication.UnicodeUTF8)) self.report_health_newrow_buttuon.setText( QApplication.translate("MainWindow", "New Row", None, QApplication.UnicodeUTF8)) ###signals and slots && other stuffs self.health = Health(emp_id=code) self.report_health_table.setEditTriggers( QAbstractItemView.NoEditTriggers) self.load_table_rows() self.report_health_table.itemDoubleClicked.connect( self.popup_health_edit) self.report_health_newrow_buttuon.clicked.connect(self.new_healthTest) self.focusInEvent = self.load_rows
def __init__(self): #### logger.info('Inside Hygiene') self.reporthygiene_tab_2 = QWidget() self.reporthygiene_tab_2.setObjectName("reporthygiene_tab_2") self.vertical_23 = QVBoxLayout(self.reporthygiene_tab_2) self.vertical_23.setObjectName("vertical_23") self.label_1 = QLabel(self.reporthygiene_tab_2) self.vertical_23.addWidget(self.label_1) self.report_hyginepest_table = QTableWidget(self.reporthygiene_tab_2) self.report_hyginepest_table.setObjectName("report_hyginepest_table") self.report_hyginepest_table.setColumnCount(5) self.report_hyginepest_table.setRowCount(0) self.report_hyginepest_table.setSelectionBehavior( QAbstractItemView.SelectRows) item = QTableWidgetItem() self.report_hyginepest_table.setHorizontalHeaderItem(0, item) item = QTableWidgetItem() self.report_hyginepest_table.setHorizontalHeaderItem(1, item) item = QTableWidgetItem() self.report_hyginepest_table.setHorizontalHeaderItem(2, item) item = QTableWidgetItem() self.report_hyginepest_table.setHorizontalHeaderItem(3, item) item = QTableWidgetItem() self.report_hyginepest_table.setHorizontalHeaderItem(4, item) self.report_hyginepest_table.horizontalHeader( ).setCascadingSectionResizes(True) self.report_hyginepest_table.horizontalHeader().setStretchLastSection( True) self.report_hyginepest_table.verticalHeader( ).setCascadingSectionResizes(True) self.vertical_23.addWidget(self.report_hyginepest_table) self.horizontal_21 = QHBoxLayout() self.report_hyginepest_newrow_buttuon = QPushButton( self.reporthygiene_tab_2) self.report_hyginepest_newrow_buttuon.setObjectName( "report_hyginepest_newrow_buttuon") self.horizontal_21.addWidget(self.report_hyginepest_newrow_buttuon) spacerItem23 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontal_21.addItem(spacerItem23) # self.report_hyginepest_save_button = QPushButton(self.reporthygiene_tab_2) # self.report_hyginepest_save_button.setObjectName("report_hyginepest_save_button") # self.horizontal_21.addWidget(self.report_hyginepest_save_button) self.vertical_23.addLayout(self.horizontal_21) self.label_2 = QLabel(self.reporthygiene_tab_2) self.vertical_23.addWidget(self.label_2) self.report_hyginewater_table = QTableWidget(self.reporthygiene_tab_2) self.report_hyginewater_table.setObjectName("report_hyginewater_table") self.report_hyginewater_table.setColumnCount(5) self.report_hyginewater_table.setRowCount(0) self.report_hyginewater_table.setSelectionBehavior( QAbstractItemView.SelectRows) item = QTableWidgetItem() self.report_hyginewater_table.setHorizontalHeaderItem(0, item) item = QTableWidgetItem() self.report_hyginewater_table.setHorizontalHeaderItem(1, item) item = QTableWidgetItem() self.report_hyginewater_table.setHorizontalHeaderItem(2, item) item = QTableWidgetItem() self.report_hyginewater_table.setHorizontalHeaderItem(3, item) item = QTableWidgetItem() self.report_hyginewater_table.setHorizontalHeaderItem(4, item) self.report_hyginewater_table.horizontalHeader( ).setCascadingSectionResizes(True) self.report_hyginewater_table.horizontalHeader().setStretchLastSection( True) self.report_hyginewater_table.verticalHeader( ).setCascadingSectionResizes(True) self.vertical_23.addWidget(self.report_hyginewater_table) self.horizontal_22 = QHBoxLayout() self.report_hyginewater_newrow_buttuon = QPushButton( self.reporthygiene_tab_2) self.report_hyginewater_newrow_buttuon.setObjectName( "report_hyginewater_newrow_buttuon") self.horizontal_22.addWidget(self.report_hyginewater_newrow_buttuon) spacerItem24 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontal_22.addItem(spacerItem24) # self.report_hyginewater_save_button = QPushButton(self.reporthygiene_tab_2) # self.report_hyginewater_save_button.setObjectName("report_hyginewater_save_button") # self.horizontal_22.addWidget(self.report_hyginewater_save_button) self.vertical_23.addLayout(self.horizontal_22) ### retanslate self.label_1.setText( QApplication.translate("MainWindow", "Pest Test Report", None, QApplication.UnicodeUTF8)) self.report_hyginepest_table.horizontalHeaderItem(0).setText( QApplication.translate("MainWindow", "Code", None, QApplication.UnicodeUTF8)) self.report_hyginepest_table.horizontalHeaderItem(1).setText( QApplication.translate("MainWindow", "Date", None, QApplication.UnicodeUTF8)) self.report_hyginepest_table.horizontalHeaderItem(2).setText( QApplication.translate("MainWindow", "Organization Name", None, QApplication.UnicodeUTF8)) self.report_hyginepest_table.horizontalHeaderItem(3).setText( QApplication.translate("MainWindow", "Test", None, QApplication.UnicodeUTF8)) self.report_hyginepest_table.horizontalHeaderItem(4).setText( QApplication.translate("MainWindow", "Description", None, QApplication.UnicodeUTF8)) self.report_hyginepest_newrow_buttuon.setText( QApplication.translate("MainWindow", "New Row", None, QApplication.UnicodeUTF8)) # self.report_hyginepest_save_button.setText( # QApplication.translate("MainWindow", "Save", None, QApplication.UnicodeUTF8)) self.label_2.setText( QApplication.translate("MainWindow", "Water Test Report", None, QApplication.UnicodeUTF8)) self.report_hyginewater_table.horizontalHeaderItem(0).setText( QApplication.translate("MainWindow", "Code", None, QApplication.UnicodeUTF8)) self.report_hyginewater_table.horizontalHeaderItem(1).setText( QApplication.translate("MainWindow", "Date", None, QApplication.UnicodeUTF8)) self.report_hyginewater_table.horizontalHeaderItem(2).setText( QApplication.translate("MainWindow", "Organization Name", None, QApplication.UnicodeUTF8)) self.report_hyginewater_table.horizontalHeaderItem(3).setText( QApplication.translate("MainWindow", "Test", None, QApplication.UnicodeUTF8)) self.report_hyginewater_table.horizontalHeaderItem(4).setText( QApplication.translate("MainWindow", "Description", None, QApplication.UnicodeUTF8)) self.report_hyginewater_newrow_buttuon.setText( QApplication.translate("MainWindow", "New Row", None, QApplication.UnicodeUTF8)) # self.report_hyginewater_save_button.setText( # QApplication.translate("MainWindow", "Save", None, QApplication.UnicodeUTF8)) ###signals and slots && other stuffs self.pest = Pest() self.water = Water() self.report_hyginepest_table.setEditTriggers( QAbstractItemView.NoEditTriggers) self.report_hyginewater_table.setEditTriggers( QAbstractItemView.NoEditTriggers) self.load_table_rows() self.report_hyginepest_table.itemDoubleClicked.connect( self.popup_pest_edit) self.report_hyginewater_table.itemDoubleClicked.connect( self.popup_water_edit) self.reporthygiene_tab_2.focusInEvent = self.load_rows # very important for focus self.report_hyginepest_newrow_buttuon.clicked.connect( self.new_pestTest) # if no focus available then we need lambda self.report_hyginewater_newrow_buttuon.clicked.connect( self.new_waterTest)