Beispiel #1
0
    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)
Beispiel #2
0
    def update_tasks(self):
        try:
            self.layout.removeItem(self.taskLayout)
        except AttributeError:
            self.taskLayout = HBoxLayout()
        else:
            for w in self.taskLayout.children():
                self.taskLayout.removeWidget(w)
            self.taskLayout = HBoxLayout()

        tasks = get_file_path(TASK_DIR)

        for t in tasks:
            task = TaskInfo(t)
            self.taskLayout.addWidget(task)
            self.tasks.append(task)
        self.layout.addLayout(self.taskLayout, 1, 0, 3, 9)
Beispiel #3
0
    def __init__(self, section, name="", parent=None):
        super(ItemWidget, self).__init__(parent)

        self.section    = section
        self.item       = Label({'txt': name})
        self.setLayout(
                        HBoxLayout({'setLayout': [self.item, 
                                                  Button({'txt' :"Edit", 
                                                          'stt' :"Edit character name", 
                                                          'cl'  : self.setText})]
                                   })
                        )
Beispiel #4
0
    def createButtonsLayout(self):
        self.newScreenshotButton = Button({
            'txt': "New Screenshot",
            'cl': self.newScreenshot
        })
        self.saveScreenshotButton = Button({
            'txt': "Save Screenshot",
            'cl': self.saveScreenshot
        })
        self.quitScreenshotButton = Button({
            'txt':
            "Quit",
            'cl':
            partial(self.signals.showLayout.emit, self.key, 'hide')
        })

        self.buttonsLayout = HBoxLayout({
            'addWidget': [
                self.newScreenshotButton, self.saveScreenshotButton,
                self.quitScreenshotButton
            ]
        })
        self.buttonsLayout.addStretch()
Beispiel #5
0
    def styleGB(self, title="", tl="grid"):
        if title == "":
            grpBox = QGroupBox()
        else:
            grpBox = QGroupBox(title)

        if tl.lower() == "grid":
            layout = GridLayout()
        elif tl.lower() == "hbox":
            layout = HBoxLayout()
        elif tl.lower() == "vbox":
            layout = VBoxLayout()

        grpBox.setLayout(layout)

        return grpBox, layout
Beispiel #6
0
class TopTab1(Widget):

    key = 'TopTab1'
    tasks = []

    def __init__(self, buttonManager, parent=None):
        super(TopTab1, self).__init__(parent)

        self.buttonManager = buttonManager
        self.parent = parent

        self.layout = GridLayout()
        self.buildUI()
        self.setLayout(self.layout)

    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 update_tasks(self):
        try:
            self.layout.removeItem(self.taskLayout)
        except AttributeError:
            self.taskLayout = HBoxLayout()
        else:
            for w in self.taskLayout.children():
                self.taskLayout.removeWidget(w)
            self.taskLayout = HBoxLayout()

        tasks = get_file_path(TASK_DIR)

        for t in tasks:
            task = TaskInfo(t)
            self.taskLayout.addWidget(task)
            self.tasks.append(task)
        self.layout.addLayout(self.taskLayout, 1, 0, 3, 9)

    def overdue(self, bool):
        for task in self.tasks:
            if task.task.status == 'Overdued':
                task.setVisible(bool)

    def urgent(self, bool):
        for task in self.tasks:
            if task.task.status == 'Urgent':
                task.setVisible(bool)

    def safety(self, bool):
        for task in self.tasks:
            if task.task.status not in ['Overdued, Urgent']:
                task.setVisible(bool)
Beispiel #7
0
    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)
Beispiel #8
0
class Screenshot(Widget):

    key = 'ScreenShot'

    def __init__(self, parent=None):
        super(Screenshot, self).__init__(parent)
        self.setWindowIcon(AppIcon(32, "Screenshot"))
        self.resize(960, 540)

        self.layout = GridLayout()
        self.buildUI()
        self.setLayout(self.layout)

        self.shootScreen()
        self.delaySpinBox.setValue(5)

    def buildUI(self):
        self.screenshotLabel = Label({
            'alg': 'center',
            'sizePolicy': ['expanding', 'expanding'],
            'smin': [240, 160]
        })

        self.createOptionsGroupBox()
        self.createButtonsLayout()

        self.layout.addWidget(self.screenshotLabel, 0, 0, 9, 16)
        self.layout.addWidget(self.optionsGroupBox, 10, 0, 1, 16)
        self.layout.addLayout(self.buttonsLayout, 11, 0, 1, 16)

    def resizeEvent(self, event):
        scaledSize = self.originalPixmap.size()
        scaledSize.scale(self.screenshotLabel.size(), keepARM)
        if not self.screenshotLabel.pixmap(
        ) or scaledSize != self.screenshotLabel.pixmap().size():
            self.updateScreenshotLabel()

    def newScreenshot(self):
        if self.hideThisWindowCheckBox.isChecked():
            self.hide()

        self.newScreenshotButton.setDisabled(True)

        QTimer.singleShot(self.delaySpinBox.value() * 1000, self.shootScreen)

    def saveScreenshot(self):
        format = 'png'
        initialPath = QDir.currentPath() + "/untitled." + format

        fileName, _ = QFileDialog.getSaveFileName(
            self, "Save As", initialPath,
            "%s Files (*.%s);;All Files (*)" % (format.upper(), format))

        if fileName:
            self.originalPixmap.save(fileName, format)

    def shootScreen(self):
        if self.delaySpinBox.value() != 0:
            QApplication.instance().beep()

        screen = QApplication.primaryScreen()
        if screen is not None:
            self.originalPixmap = screen.grabWindow(0)
        else:
            self.originalPixmap = QPixmap()

        self.updateScreenshotLabel()

        self.newScreenshotButton.setDisabled(False)
        if self.hideThisWindowCheckBox.isChecked():
            self.show()

    def updateCheckBox(self):
        if self.delaySpinBox.value() == 0:
            self.hideThisWindowCheckBox.setDisabled(True)
        else:
            self.hideThisWindowCheckBox.setDisabled(False)

    def createOptionsGroupBox(self):
        self.optionsGroupBox = QGroupBox("Options")

        self.delaySpinBox = QSpinBox()
        self.delaySpinBox.setSuffix(" s")
        self.delaySpinBox.setMaximum(60)
        self.delaySpinBox.valueChanged.connect(self.updateCheckBox)

        self.delaySpinBoxLabel = QLabel("Screenshot Delay:")

        self.hideThisWindowCheckBox = QCheckBox("Hide This Window")

        optionsGroupBoxLayout = QGridLayout()
        optionsGroupBoxLayout.addWidget(self.delaySpinBoxLabel, 0, 0)
        optionsGroupBoxLayout.addWidget(self.delaySpinBox, 0, 1)
        optionsGroupBoxLayout.addWidget(self.hideThisWindowCheckBox, 1, 0, 1,
                                        2)
        self.optionsGroupBox.setLayout(optionsGroupBoxLayout)

    def createButtonsLayout(self):
        self.newScreenshotButton = Button({
            'txt': "New Screenshot",
            'cl': self.newScreenshot
        })
        self.saveScreenshotButton = Button({
            'txt': "Save Screenshot",
            'cl': self.saveScreenshot
        })
        self.quitScreenshotButton = Button({
            'txt':
            "Quit",
            'cl':
            partial(self.signals.showLayout.emit, self.key, 'hide')
        })

        self.buttonsLayout = HBoxLayout({
            'addWidget': [
                self.newScreenshotButton, self.saveScreenshotButton,
                self.quitScreenshotButton
            ]
        })
        self.buttonsLayout.addStretch()
        # self.buttonsLayout.addWidget(self.newScreenshotButton)
        # self.buttonsLayout.addWidget(self.saveScreenshotButton)
        # self.buttonsLayout.addWidget(self.quitScreenshotButton)

    def updateScreenshotLabel(self):
        self.screenshotLabel.setPixmap(
            self.originalPixmap.scaled(self.screenshotLabel.size(),
                                       Qt.KeepAspectRatio,
                                       Qt.SmoothTransformation))