def __init__(self, parent=True): super(TaskManager, self).__init__(parent) self.parent = parent self.setWindowTitle('Task Manager') self.layout = VBoxLayout() line1 = HBoxLayout() line2 = HBoxLayout() self.infoGrp = GroupBox('Task Info') self.taskInfo = TaskInfo(self) self.infoGrp.setLayout(self.taskInfo) line1.addWidget(self.infoGrp) self.detailsGrp = GroupBox('Details') self.taskDetails = TaskDetails(self) self.detailsGrp.setLayout(self.taskDetails) line1.addWidget(self.detailsGrp) self.layout.addLayout(line1) self.layout.addLayout(line2) self.okButton = Button({'txt': 'Ok', 'cl': self.executeTask}) self.cancelButton = Button({'txt': 'Cancel', 'cl': self.hideEvent}) line2.addWidget(self.okButton) line2.addWidget(self.cancelButton) self.setLayout(self.layout) self.setMinimumWidth(750)
def __init__(self, parent=None): super(ServerConfig, self).__init__(parent) serverLabel = Label({'txt':"Server:"}) serverCombo = ComboBox({'items': ['Local: {}'.format(__localServer__), 'Global: {}'.format(__globalServer__)]}) serverLayout = HBoxLayout({'addWidget': [serverLabel, serverCombo]}) serverConfigLayout = VBoxLayout({'addLayout': [serverLayout]}) serverConfigGroup = GroupBox("Server configuration", [serverConfigLayout], 'setLayout') projectLabel = Label({'txt': "Set Project:"}) projectPath = LineEdit() projectBtn = Button({'txt': 'Set Path'}) projectLayout = HBoxLayout({'addWidget': [projectLabel, projectPath, projectBtn]}) projectConfigLayout = VBoxLayout({'addLayout': [projectLayout]}) projectConfigGroup = GroupBox("Project configuration", [projectConfigLayout], 'setLayout') teamtLabel = Label({'txt': "Set Team:"}) teamPath = LineEdit() teamBtn = Button({'txt': 'Set Team'}) teamLayout = HBoxLayout({'addWidget': [teamtLabel, teamPath, teamBtn]}) teamConfigLayout = VBoxLayout({'addLayout': [teamLayout]}) TeamConfigGroup = GroupBox("Project configuration", [teamConfigLayout], 'setLayout') mainLayout = VBoxLayout({'addWidget': [serverConfigGroup, projectConfigGroup, TeamConfigGroup], 'addStretch': 1}) self.setLayout(mainLayout)
class Preferences(Widget): key = 'Preferences' _msg_user_not_set = "Not configured yet, will be set with the first message received" def __init__(self, parent=None): super(Preferences, self).__init__(parent) # self.resize(200, 100) self.setWindowIcon(AppIcon(32, self.key)) self.setWindowTitle(self.key) # self.layout = GeneralSetting(self) self.layout = VBoxLayout() self.headerGrid = HeaderCheckBoxes(self) self.header = GroupBox('Header', parent=self) self.header.setLayout(self.headerGrid) self.bodyGrid = BodyCheckBoxes(self) self.body = GroupBox('Body', parent=self) self.body.setLayout(self.bodyGrid) self.layout.addWidget(self.header) self.layout.addWidget(self.body) self.setLayout(self.layout)
def buildUI(self): self.query = usql.QuerryDB() try: self.username, token, cookie, remember = self.query.query_table('curUser') except (ValueError, IndexError): self.username = '******' self.avatar = QLabel() self.avatar.setPixmap(QPixmap.fromImage(QImage(get_avatar_icon(self.username)))) self.avatar.setScaledContents(True) self.avatar.setFixedSize(100, 100) btn1 = Button({'txt':'Account Setting', 'cl': partial(self.showLayout.emit, 'userSetting', 'show')}) btn2 = Button({'txt':'Log Out', 'cl': partial(self.showLayout.emit, 'login', 'show')}) btns = [btn1, btn2] sec1Grp = GroupBox(self.username, [self.avatar], "ImageView") sec2Grp = GroupBox("Setting", btns, "BtnGrid") sec3Grp = QGroupBox("Messenger") sec3Grid = QGridLayout() sec3Grp.setLayout(sec3Grid) self.layout.addWidget(sec1Grp, 0, 0, 1, 1) self.layout.addWidget(sec2Grp, 1, 0, 1, 1) self.layout.addWidget(sec3Grp, 0, 1, 2, 2) self.applySetting()
def buildUI(self): btn1 = Button({ 'txt': 'New Project', 'tt': 'Create New Project', 'cl': partial(self.showLayout.emit, 'newProj', 'show') }) btn2 = Button({ 'txt': 'New Group', 'tt': 'Create New Group', 'cl': partial(self.showLayout.emit, 'newGrp', 'show') }) btn3 = Button({ 'txt': 'Your Projects', 'tt': 'Your Projects', 'cl': partial(self.showLayout.emit, 'yourPrj', 'show') }) btn4 = Button({ 'txt': 'Find crew', 'tt': 'Find crew', 'cl': partial(self.showLayout.emit, 'findCrew', 'show') }) btn5 = Button({ 'txt': 'Get crew', 'tt': 'Check applicant', 'cl': partial(self.showLayout.emit, 'getCrew', 'show') }) btn6 = Button({ 'txt': 'Your crew', 'tt': 'Your crew', 'cl': partial(self.showLayout.emit, 'yourCrew', 'show') }) sec1Grp = GroupBox("Project", [btn1, btn2, btn3], "BtnGrid") sec2Grp = GroupBox("Crew", [btn4, btn5, btn6], "BtnGrid") sec3Grp = QGroupBox('Info') sec3Grid = QGridLayout() sec3Grp.setLayout(sec3Grid) self.layout.addWidget(sec1Grp, 0, 0, 3, 3) self.layout.addWidget(sec2Grp, 3, 0, 3, 3) self.layout.addWidget(sec3Grp, 0, 3, 6, 6)
def buildUI(self): self.prjButtons = self.buttonManager.projectButtonsGroupBox(self.parent) self.taskButtons = self.buttonManager.taskButtonsGroupBox(self.parent) self.teamButtons = self.buttonManager.teamButtonsGroupBox(self.parent) self.update_tasks() self.prjGrp = GroupBox("Project", self.prjButtons, "BtnGrid") self.taskGrp = GroupBox("Task", self.taskButtons, "BtnGrid") self.teamGrp = GroupBox('Team', self.teamButtons, 'BtnGrid') self.tabFilter = TopTap1Filter() self.tabFilter.overduedCB.stateChanged.connect(self.overdue) self.tabFilter.urgentCB.stateChanged.connect(self.urgent) self.tabFilter.safetyCB.stateChanged.connect(self.safety) self.layout.addWidget(self.prjGrp, 5, 0, 2, 2) self.layout.addWidget(self.taskGrp, 5, 2, 2, 2) self.layout.addWidget(self.teamGrp, 5, 4, 2, 2) self.layout.addWidget(self.tabFilter, 5, 6, 2, 3)
def __init__(self, parent=None): super(Preferences, self).__init__(parent) # self.resize(200, 100) self.setWindowIcon(AppIcon(32, self.key)) self.setWindowTitle(self.key) # self.layout = GeneralSetting(self) self.layout = VBoxLayout() self.headerGrid = HeaderCheckBoxes(self) self.header = GroupBox('Header', parent=self) self.header.setLayout(self.headerGrid) self.bodyGrid = BodyCheckBoxes(self) self.body = GroupBox('Body', parent=self) self.body.setLayout(self.bodyGrid) self.layout.addWidget(self.header) self.layout.addWidget(self.body) self.setLayout(self.layout)
def buildUI(self): officeBtns = [] keys = ['TextEditor', 'NoteReminder'] for key in keys: if key in self.appInfo: btn = Button({'icon':key, 'tt': self.appInfo[key][2], 'fix': BTNICONSIZE, 'ics': ICONBTNSIZE, 'emit2':[self.signals.showLayout.emit, [FIX_KEYS[key], 'show']]}) officeBtns.append(btn) for key in CONFIG_OFFICE: if key in self.appInfo: btn = Button({'icon': key, 'tt': self.appInfo[key][2], 'fix': BTNICONSIZE, 'ics': ICONBTNSIZE, 'emit1': [self.signals.executing.emit, self.appInfo[key][2]]}) officeBtns.append(btn) devBtns = [] for key in CONFIG_DEV: if key in self.appInfo: btn = Button({'icon': key, 'tt': self.appInfo[key][2], 'fix': BTNICONSIZE, 'ics': ICONBTNSIZE, 'emit1': [self.signals.executing.emit, self.appInfo[key][2]]}) devBtns.append(btn) pyuiBtn = [] for key in CONFIG_TOOLS: if key in self.appInfo: btn = Button({'icon': key, 'tt': self.appInfo[key][2], 'fix': BTNICONSIZE, 'ics': ICONBTNSIZE, 'emit2': [self.signals.showLayout.emit, [FIX_KEYS[key], 'show']]}) pyuiBtn.append(btn) extraBtns = [] for key in CONFIG_EXTRA: if key in self.appInfo: btn = Button({'icon': key, 'tt': self.appInfo[key][2], 'fix': BTNICONSIZE, 'ics': ICONBTNSIZE, 'emit2': [self.signals.executing.emit, key]}) extraBtns.append(btn) sec1Grp = GroupBox("Office", officeBtns, "IconGrid") sec2Grp = GroupBox("Dev", devBtns, "IconGrid") sec3Grp = GroupBox("Tools", pyuiBtn, "IconGrid") sec4Grp = GroupBox("Extra", extraBtns, "IconGrid") self.findEdit = LineEdit() findBtn = Button({'txt':"Find Tool"}) sec5Grp = GroupBox("Find Tool") sec5Grid = GridLayout() sec5Grid.addWidget(self.findEdit, 0, 0, 1, 7) sec5Grid.addWidget(findBtn, 0, 7, 1, 2) sec5Grp.setLayout(sec5Grid) self.layout.addWidget(sec1Grp, 0, 0, 2, 3) self.layout.addWidget(sec2Grp, 2, 0, 2, 3) self.layout.addWidget(sec3Grp, 0, 3, 4, 3) self.layout.addWidget(sec4Grp, 0, 6, 4, 3) self.layout.addWidget(sec5Grp, 4, 0, 1, 9)
def buildUI(self): self.query = usql.QuerryDB() try: self.username, token, cookie, remember = self.query.query_table( 'curUser') except (ValueError, IndexError): self.username = '******' self.avatar = QLabel() self.avatar.setPixmap(QPixmap(get_avatar_image(self.username))) self.avatar.setScaledContents(True) self.avatar.setFixedSize(100, 100) self.avatarGrp = GroupBox(self.username, [self.avatar], "ImageView") self.avatarBtn = self.buttonManager.userButtonGroupBox(self.parent) self.settingGrp = GroupBox("Setting", self.avatarBtn, "BtnGrid") self.messGrp, sec3Grid = GroupGrid("Messenger") self.layout.addWidget(self.avatarGrp, 0, 0, 3, 3) self.layout.addWidget(self.settingGrp, 3, 0, 3, 3) self.layout.addWidget(self.messGrp, 0, 3, 6, 6)
def step2_layout(self): step2_groupBox = GroupBox("Step 2") step2_layout = VBoxLayout() step2_groupBox.setLayout(step2_layout) self.question1 = Label({'txt': "Question 1"}) self.question2 = Label({'txt': "Question 2"}) self.answer1 = LineEdit() self.answer2 = LineEdit() step2_btn_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) step2_btn_box.accepted.connect(self.on_step2_btn_clicked) step2_btn_box.rejected.connect(self.close) step2_layout.addWidget(self.question1) step2_layout.addWidget(self.answer1) step2_layout.addWidget(self.question2) step2_layout.addWidget(self.answer2) step2_layout.addWidget(step2_btn_box) return step2_groupBox
def __init__(self, parent=None): super(UpdatePage, self).__init__(parent) updateGroup = GroupBox("Package selection") systemCheckBox = CheckBox("Update system") appsCheckBox = CheckBox("Update applications") docsCheckBox = CheckBox("Update documentation") packageGroup = GroupBox("Existing packages") packageList = QListWidget() qtItem = QListWidgetItem(packageList) qtItem.setText("Qt") qsaItem = QListWidgetItem(packageList) qsaItem.setText("QSA") teamBuilderItem = QListWidgetItem(packageList) teamBuilderItem.setText("Teambuilder") startUpdateButton = Button({'txt':"Start update"}) updateLayout = VBoxLayout({'addWidget': [systemCheckBox, appsCheckBox, docsCheckBox]}) # updateLayout.addWidget(systemCheckBox) # updateLayout.addWidget(appsCheckBox) # updateLayout.addWidget(docsCheckBox) updateGroup.setLayout(updateLayout) packageLayout = QVBoxLayout() packageLayout.addWidget(packageList) packageGroup.setLayout(packageLayout) mainLayout = QVBoxLayout() mainLayout.addWidget(updateGroup) mainLayout.addWidget(packageGroup) mainLayout.addSpacing(12) mainLayout.addWidget(startUpdateButton) mainLayout.addStretch(1) self.setLayout(mainLayout)
class TaskManager(Widget): key = 'TaskManager' def __init__(self, parent=True): super(TaskManager, self).__init__(parent) self.parent = parent self.setWindowTitle('Task Manager') self.layout = VBoxLayout() line1 = HBoxLayout() line2 = HBoxLayout() self.infoGrp = GroupBox('Task Info') self.taskInfo = TaskInfo(self) self.infoGrp.setLayout(self.taskInfo) line1.addWidget(self.infoGrp) self.detailsGrp = GroupBox('Details') self.taskDetails = TaskDetails(self) self.detailsGrp.setLayout(self.taskDetails) line1.addWidget(self.detailsGrp) self.layout.addLayout(line1) self.layout.addLayout(line2) self.okButton = Button({'txt': 'Ok', 'cl': self.executeTask}) self.cancelButton = Button({'txt': 'Cancel', 'cl': self.hideEvent}) line2.addWidget(self.okButton) line2.addWidget(self.cancelButton) self.setLayout(self.layout) self.setMinimumWidth(750) def executeTask(self): h = int(self.taskInfo.hour.text()) m = int(self.taskInfo.minute.text()) s = int(self.taskInfo.second.text()) self.duetime = duetime(h, m, s) y = int(self.taskInfo.year.text()) mo = int(self.taskInfo.month.text()) d = int(self.taskInfo.day.text()) self.duedate = duedate(d, mo, y) id = self.taskInfo.taskID.text() name = self.taskInfo.taskName.text() type = self.taskDetails.taskType mode = self.taskDetails.taskMode project = [ self.taskInfo.projectID.text(), self.taskInfo.projectName.text() ] organisation = [ self.taskInfo.organisationID.text(), self.taskInfo.organisationName.text() ] details = self.taskDetails.taskDetails.toPlainText() Task(id, name, mode, type, project, organisation, self.duetime, self.duedate, details) self.parent.topTabUI.tab1.update_tasks() def resizeEvent(self, event): w = int(self.width()) self.infoGrp.setMaximumWidth(w / 3) # ------------------------------------------------------------------------------------------------------------- # Created by panda on 19/11/2019 - 12:48 AM # © 2017 - 2018 DAMGteam. All rights reserved
def buildUI(self): self.mainMenuBar = MainMenuBar(self.actionManager, self) self.mainToolBar = MainToolBar(self.actionManager, self) self.connectStatus = ConnectStatus(self) self.notification = Notification(self.threadManager, self) self.mainMenuSec = GroupBox("Main Menu", self.mainMenuBar, "qmainLayout", self) self.connectStatusSec = GroupBox("Connect Status", self.connectStatus, "autoGrid", self) self.mainToolBarSec = GroupBox("Tool Bar", self.mainToolBar, "qmainLayout", self) self.notifiSec = GroupBox("Notification", self.notification, "autoGrid", self) self.mainMenuSec.key = "MainMenuSectionSection" self.mainToolBarSec.key = "MainToolBarSectionSection" self.connectStatusSec.key = "ConnectStatusSection" self.notifiSec.key = "NotificationSection" self.mainMenuSec.setParent(self) self.mainToolBarSec.setParent(self) self.connectStatusSec.setParent(self) self.notifiSec.setParent(self) self.topTabUI = TopTab(self.buttonManager, self) self.botTabUI = BotTab(self) self.footer = Footer(self.buttonManager, self.threadManager, self) self.statusBar = MainStatusBar(self) self.layouts = [ self.mainMenuBar, self.mainToolBar, self.connectStatus, self.notification, self.mainMenuSec, self.mainToolBarSec, self.connectStatusSec, self.notifiSec, self.topTabUI, self.botTabUI, self.footer, self.statusBar, ] # self.allowSettingLayouts = [self.mainMenuBar, self.mainToolBar, self.connectStatus, self.notification, ] # self.topTabUI, self.botTabUI, self.footer, self.statusBar, ] # for layout in self.allowSettingLayouts: # layout.settings._settingEnable = True # for layout in self.layouts: # print(layout.key) # layout.signals.connect('executing', self.signals.executing) # layout.signals.connect('regisLayout', self.signals.regisLayout) # layout.signals.connect('openBrowser', self.signals.openBrowser) # layout.signals.connect('setSetting', self.signals.setSetting) # layout.signals.connect('showLayout', self.signals.showLayout) # layout.settings._settingEnable = True # Header # Header Menu self.layout.addWidget(self.mainMenuSec, 0, 0, 1, 7) self.layout.addWidget(self.connectStatusSec, 0, 7, 1, 2) # Header ToolBar self.layout.addWidget(self.mainToolBarSec, 1, 0, 1, 9) # Body # Body top self.layout.addWidget(self.topTabUI, 2, 0, 4, 9) # Body bot self.layout.addWidget(self.botTabUI, 6, 0, 3, 6) self.layout.addWidget(self.notifiSec, 6, 6, 3, 3) # Footer # Footer layout self.layout.addWidget(self.footer, 9, 0, 1, 9) # Footer status bar self.setStatusBar(self.statusBar)
class PipelineManager(MainWindow): key = 'PipelineManager' _name = __appname__ def __init__(self, actionManager, buttonManager, threadManager, parent=None): super(PipelineManager, self).__init__(parent) self.url = __homepage__ self.setObjectName(self._name) self.setWindowTitle(__appname__) self.setWindowIcon(LogoIcon("Logo")) self.actionManager = actionManager self.buttonManager = buttonManager self.threadManager = threadManager self.mainWidget = Widget() self.layout = GridLayout() self.mainWidget.setLayout(self.layout) self.buildUI() self.setCentralWidget(self.mainWidget) def buildUI(self): self.mainMenuBar = MainMenuBar(self.actionManager, self) self.mainToolBar = MainToolBar(self.actionManager, self) self.connectStatus = ConnectStatus(self) self.notification = Notification(self.threadManager, self) self.mainMenuSec = GroupBox("Main Menu", self.mainMenuBar, "qmainLayout", self) self.connectStatusSec = GroupBox("Connect Status", self.connectStatus, "autoGrid", self) self.mainToolBarSec = GroupBox("Tool Bar", self.mainToolBar, "qmainLayout", self) self.notifiSec = GroupBox("Notification", self.notification, "autoGrid", self) self.mainMenuSec.key = "MainMenuSectionSection" self.mainToolBarSec.key = "MainToolBarSectionSection" self.connectStatusSec.key = "ConnectStatusSection" self.notifiSec.key = "NotificationSection" self.mainMenuSec.setParent(self) self.mainToolBarSec.setParent(self) self.connectStatusSec.setParent(self) self.notifiSec.setParent(self) self.topTabUI = TopTab(self.buttonManager, self) self.botTabUI = BotTab(self) self.footer = Footer(self.buttonManager, self.threadManager, self) self.statusBar = MainStatusBar(self) self.layouts = [ self.mainMenuBar, self.mainToolBar, self.connectStatus, self.notification, self.mainMenuSec, self.mainToolBarSec, self.connectStatusSec, self.notifiSec, self.topTabUI, self.botTabUI, self.footer, self.statusBar, ] # self.allowSettingLayouts = [self.mainMenuBar, self.mainToolBar, self.connectStatus, self.notification, ] # self.topTabUI, self.botTabUI, self.footer, self.statusBar, ] # for layout in self.allowSettingLayouts: # layout.settings._settingEnable = True # for layout in self.layouts: # print(layout.key) # layout.signals.connect('executing', self.signals.executing) # layout.signals.connect('regisLayout', self.signals.regisLayout) # layout.signals.connect('openBrowser', self.signals.openBrowser) # layout.signals.connect('setSetting', self.signals.setSetting) # layout.signals.connect('showLayout', self.signals.showLayout) # layout.settings._settingEnable = True # Header # Header Menu self.layout.addWidget(self.mainMenuSec, 0, 0, 1, 7) self.layout.addWidget(self.connectStatusSec, 0, 7, 1, 2) # Header ToolBar self.layout.addWidget(self.mainToolBarSec, 1, 0, 1, 9) # Body # Body top self.layout.addWidget(self.topTabUI, 2, 0, 4, 9) # Body bot self.layout.addWidget(self.botTabUI, 6, 0, 3, 6) self.layout.addWidget(self.notifiSec, 6, 6, 3, 3) # Footer # Footer layout self.layout.addWidget(self.footer, 9, 0, 1, 9) # Footer status bar self.setStatusBar(self.statusBar) def add_dockWidget(self, dock, pos=dockB): dock.signals.showLayout.connect(self.signals.showLayout) dock.signals.setSetting.connect(self.signals.setSetting) dock.signals.executing.connect(self.signals.executing) dock.signals.regisLayout.connect(self.signals.regisLayout) dock.signals.openBrowser.connect(self.signals.openBrowser) self.addDockWidget(pos, dock) # def resizeEvent(self, event): # # w = self.width() # h = self.height() # p = 15 # # hd = 2 # tt = 6 # bt = 3 # ft = 2 # # self.mainMenuSec.resize(w*3/5, h/p) # self.connectStatusSec.resize(w*2/5, h/p) # self.mainToolBarSec.resize(w-2, h/p) # # self.topTabUI.resize(w-2, h*tt/p) # self.botTabUI.resize(w*2/3, h*bt/p) # self.notifiSec.resize(w/3, h*bt/p) # # self.footer.resize(w-2, h/p) # self.statusBar.resize(w-2, h/p) def showEvent(self, event): for layout in [ self.mainMenuSec, self.mainMenuSec, self.connectStatusSec, self.notifiSec ]: if layout.isHidden(): self.signals.emit('showLayout', layout.key, 'show') def keyPressEvent(self, event): print('aa: {0}'.format(event.key())) if event.key() == Qt.CTRL + Qt.Key_Backspace: print(event.key()) @property def mode(self): return self.connectStatus.mode
self.projectMenu = menu.addMenu('&Project') prjActions = self.actionManger.projectMenuActions(self.parent) self.add_actions(self.projectMenu, prjActions) menu.addSeparator() self.add_actions(menu, actions[3:]) return menu def add_actions(self, menu, actions): for action in actions: menu.addAction(action) def showMenu(self, bool): cb = self.sender() key = cb.key.replace('CheckBox_', '').replace('Preferences', self.key) for k, menu in self.menus.items(): if key == k: menu.setEnabled(bool) if __name__ == '__main__': app = QApplication(sys.argv) from ui.uikits.GroupBox import GroupBox subMenu = MainMenuBar() layout = GroupBox("Main Menu", subMenu, "qmainLayout") layout.show() app.exec_() # ------------------------------------------------------------------------------------------------------------- # Created by panda on 11/07/2018 - 12:59 AM # © 2017 - 2018 DAMGteam. All rights reserved