Exemplo n.º 1
0
    def buildUI(self):

        loginGrp, loginGrid = GroupGrid('Sign in')

        self.userTF = LineEdit()
        self.pwTF = LineEdit({'fm': 'password'})
        self.userCB = QCheckBox('Remember me?')

        forgot_pw_btn = Button({'txt': 'Forgot your password?', 'cl': partial(self.showLayout.emit, 'forgotpw', 'show')})
        login_btn = Button({'txt': 'Log in', 'cl': self.signInClicked})
        cancel_btn = Button({'txt': 'Cancel', 'cl': QApplication.quit})

        loginGrid.addWidget(Label({'txt': 'Username'}), 0, 0, 1, 2)
        loginGrid.addWidget(Label({'txt': 'Password'}), 1, 0, 1, 2)
        loginGrid.addWidget(self.userTF, 0, 2, 1, 4)
        loginGrid.addWidget(self.pwTF, 1, 2, 1, 4)
        loginGrid.addWidget(self.userCB, 2, 1, 1, 2)
        loginGrid.addWidget(login_btn, 2, 3, 1, 3)
        loginGrid.addWidget(forgot_pw_btn, 3, 0, 1, 3)
        loginGrid.addWidget(cancel_btn, 3, 3, 1, 3)

        signupGrp, signupGrid = GroupGrid('Sign up')
        signupBtn = Button({'txt':'Sign up', 'emit2': [self.showLayout.emit, ['signup', 'show']]})

        signupGrid.addWidget(Label({'txt': SIGNUP}), 0, 0, 1, 6)
        signupGrid.addWidget(signupBtn, 1, 0, 1, 6)

        self.layout.addWidget(loginGrp, 0, 0, 1, 1)
        self.layout.addWidget(signupGrp, 1, 0, 1, 1)
Exemplo n.º 2
0
    def change_profile_section(self):

        profile_groupBox, profile_layout = GroupGrid("Change Profile")

        profile_layout.addWidget(Label({'txt': 'First Name'}), 0, 0, 1, 2)
        profile_layout.addWidget(Label({'txt': 'Last Name'}), 1, 0, 1, 2)
        profile_layout.addWidget(Label({'txt': 'Your Title'}), 2, 0, 1, 2)
        profile_layout.addWidget(Label({'txt': 'Email'}), 3, 0, 1, 2)
        profile_layout.addWidget(Label({'txt': 'Phone Number'}), 4, 0, 1, 2)

        self.firstnameField             = LineEdit()
        self.lastnameField              = LineEdit()
        self.titleField                 = LineEdit()
        self.emailField                 = LineEdit()
        self.phoneField                 = LineEdit()

        change_profile_btn = Button({'txt': "Update Profile", 'cl': self.update_profile})

        profile_layout.addWidget(self.firstnameField, 0, 2, 1, 4)
        profile_layout.addWidget(self.lastnameField, 1, 2, 1, 4)
        profile_layout.addWidget(self.titleField, 2, 2, 1, 4)
        profile_layout.addWidget(self.emailField, 3, 2, 1, 4)
        profile_layout.addWidget(self.phoneField, 4, 2, 1, 4)
        profile_layout.addWidget(change_profile_btn, 5, 0, 1, 6)

        return profile_groupBox
Exemplo n.º 3
0
    def change_location_section(self):

        location_groupBox, location_layout = GroupGrid("Change Location")

        location_layout.addWidget(Label({'txt': 'Address Line 1'}), 0, 0, 1, 2)
        location_layout.addWidget(Label({'txt': 'Address Line 2'}), 1, 0, 1, 2)
        location_layout.addWidget(Label({'txt': 'Postal'}), 2, 0, 1, 2)
        location_layout.addWidget(Label({'txt': 'City'}), 3, 0, 1, 2)
        location_layout.addWidget(Label({'txt': 'Country'}), 4, 0, 1, 2)

        self.address1Field              = LineEdit()
        self.address2Field              = LineEdit()
        self.postalField                = LineEdit()
        self.cityField                  = LineEdit()
        self.countryField               = LineEdit()

        change_location_btn = Button({'txt': "Update Location", 'cl': self.update_location})

        location_layout.addWidget(self.address1Field, 0, 2, 1, 4)
        location_layout.addWidget(self.address2Field, 1, 2, 1, 4)
        location_layout.addWidget(self.postalField, 2, 2, 1, 4)
        location_layout.addWidget(self.cityField, 3, 2, 1, 4)
        location_layout.addWidget(self.countryField, 4, 2, 1, 4)
        location_layout.addWidget(change_location_btn, 5, 0, 1, 6)

        return location_groupBox
Exemplo n.º 4
0
    def buttons_section(self):
        self.btnSection, btn_grid = GroupGrid()

        self.user_agree_checkBox = CheckBox(txt=USER_CHECK_REQUIRED)
        okBtn = Button({
            'txt': 'Create Account',
            'tt': 'Confirm to create an account',
            'cl': self.createBtnClicked
        })
        cancelBtn = Button({
            'txt':
            'Cancel',
            'tt':
            'Go back to Login stage',
            'cl':
            partial(self.signals.emit, 'showLayout', 'SignIn', 'SignIn')
        })
        quitBtn = Button({
            'txt': 'Quit',
            'tt': 'Quit the application',
            'cl': QApplication.quit
        })

        btn_grid.addWidget(self.user_agree_checkBox, 0, 0, 1, 6)
        btn_grid.addWidget(okBtn, 1, 0, 1, 2)
        btn_grid.addWidget(cancelBtn, 1, 2, 1, 2)
        btn_grid.addWidget(quitBtn, 1, 4, 1, 2)
Exemplo n.º 5
0
    def buildUI(self):

        sec1Grp, sec1Grid = GroupGrid('Test Layout')

        # sec1Grid.addWidget(rc.Label("Update later"), 0, 0, 6, 9)
        sec1Grid.addWidget(BubblesWidget(), 0, 0, 6, 9)
        self.layout.addWidget(sec1Grp, 0, 0, 6, 9)
Exemplo n.º 6
0
    def avatar_section(self):
        self.avaSection, avatar_grid = GroupGrid("Avatar")

        self.userAvatar = Label({'pxm':'default', 'scc': True, 'sfs':[100, 100]})

        set_avatarBtn = Button({'txt':'Set Avatar', 'tt':'Choose a new avatar', 'cl': self.setAvaClicked})

        avatar_grid.addWidget(self.userAvatar, 0, 0, 2, 2)
        avatar_grid.addWidget(set_avatarBtn, 2, 0, 1, 2)
Exemplo n.º 7
0
    def account_section(self):
        self.accSection, account_grid = GroupGrid("Account")
        self.userField = LineEdit()
        self.pwField = LineEdit({'fm': 'password'})
        self.cfpwField = LineEdit({'fm': 'password'})

        account_grid.addWidget(Label({'txt':'User Name'}), 0, 0, 1, 2)
        account_grid.addWidget(Label({'txt':'Password'}), 1, 0, 1, 2)
        account_grid.addWidget(Label({'txt':'Confirm Password'}), 2, 0, 1, 2)

        account_grid.addWidget(self.userField, 0, 3, 1, 4)
        account_grid.addWidget(self.pwField, 1, 3, 1, 4)
        account_grid.addWidget(self.cfpwField, 2, 3, 1, 4)
Exemplo n.º 8
0
    def change_pass_section(self):

        password_groupBox, password_layout = GroupGrid('Change Password')

        self.old_pass                   = LineEdit({'echo': 'password'})
        self.new_pass                   = LineEdit({'echo': 'password'})
        self.confirm_pass               = LineEdit({'echo': 'password'})
        change_pass_btn                 = Button({'txt': 'Change Password', 'cl': self.update_password})

        password_layout.addWidget(Label({'txt': 'Old Password'}), 0, 0, 1, 2)
        password_layout.addWidget(Label({'txt': 'New Password'}), 1, 0, 1, 2)
        password_layout.addWidget(Label({'txt': 'Confirm Password'}), 2, 0, 1, 2)
        password_layout.addWidget(self.old_pass, 0, 2, 1, 4)
        password_layout.addWidget(self.new_pass, 1, 2, 1, 4)
        password_layout.addWidget(self.confirm_pass, 2, 2, 1, 4)
        password_layout.addWidget(change_pass_btn, 3, 0, 1, 6)

        return password_groupBox
Exemplo n.º 9
0
    def security_section(self):

        self.serSection, questions_grid = GroupGrid("Security Question")

        self.ques1 = ComboBox({'items': [str(i) for i in QUESTIONS.split('\n')]})
        self.answ2 = LineEdit()
        self.ques2 = ComboBox({'items': [str(i) for i in QUESTIONS.split('\n')]})
        self.answ1 = LineEdit()

        questions_grid.addWidget(Label({'txt':'Question 1'}), 0, 0, 1, 3)
        questions_grid.addWidget(Label({'txt':'Answer 1'}), 1, 0, 1, 3)
        questions_grid.addWidget(Label({'txt':'Question 2'}), 2, 0, 1, 3)
        questions_grid.addWidget(Label({'txt':'Answer 2'}), 3, 0, 1, 3)

        questions_grid.addWidget(self.ques1, 0, 3, 1, 6)
        questions_grid.addWidget(self.answ1, 1, 3, 1, 6)
        questions_grid.addWidget(self.ques2, 2, 3, 1, 6)
        questions_grid.addWidget(self.answ2, 3, 3, 1, 6)
Exemplo n.º 10
0
    def change_avatar_section(self):

        try:
            self.username, token, cookie, remember = self.query.query_table('curUser')
        except (ValueError, IndexError):
            self.username = '******'

        avatar_groupBox, avatar_layout = GroupGrid('Change Avatar')

        self.avatar = Label()
        self.avatar.setPixmap(QPixmap.fromImage(QImage(get_avatar_image(self.username))))
        self.avatar.setScaledContents(True)
        self.avatar.setFixedSize(100, 100)

        change_avatar_btn = Button({'txt':'Change Avatar', 'cl': self.update_avatar})
        avatar_layout.addWidget(self.avatar)
        avatar_layout.addWidget(change_avatar_btn)

        return avatar_groupBox
Exemplo n.º 11
0
    def profile_section(self):
        self.prfSection, profile_grid = GroupGrid("Profile")

        profile_grid.addWidget(Label({'txt':'First Name'}), 0, 0, 1, 2)
        profile_grid.addWidget(Label({'txt':'Last Name'}), 1, 0, 1, 2)
        profile_grid.addWidget(Label({'txt':'Your Title'}), 2, 0, 1, 2)
        profile_grid.addWidget(Label({'txt':'Email'}), 3, 0, 1, 2)
        profile_grid.addWidget(Label({'txt':'Phone Number'}), 4, 0, 1, 2)

        self.titleField = LineEdit()
        self.firstnameField = LineEdit()
        self.lastnameField = LineEdit()
        self.emailField = LineEdit()
        self.phoneField = LineEdit()

        profile_grid.addWidget(self.firstnameField, 0, 2, 1, 4)
        profile_grid.addWidget(self.lastnameField, 1, 2, 1, 4)
        profile_grid.addWidget(self.titleField, 2, 2, 1, 4)
        profile_grid.addWidget(self.emailField, 3, 2, 1, 4)
        profile_grid.addWidget(self.phoneField, 4, 2, 1, 4)
Exemplo n.º 12
0
    def location_section(self):
        self.conSection, conGrid = GroupGrid("Location")

        conGrid.addWidget(Label({'txt':"Address Line 1"}), 0, 0, 1, 2)
        conGrid.addWidget(Label({'txt':"Address Line 2"}), 1, 0, 1, 2)
        conGrid.addWidget(Label({'txt':"Postal"}), 2, 0, 1, 2)
        conGrid.addWidget(Label({'txt':"City"}), 3, 0, 1, 2)
        conGrid.addWidget(Label({'txt':"Country"}), 4, 0, 1, 2)

        self.addressLine1 = LineEdit()
        self.addressLine2 = LineEdit()
        self.postalCode = LineEdit()
        self.city = LineEdit()
        self.country = LineEdit()

        conGrid.addWidget(self.addressLine1, 0, 2, 1, 4)
        conGrid.addWidget(self.addressLine2, 1, 2, 1, 4)
        conGrid.addWidget(self.city, 2, 2, 1, 4)
        conGrid.addWidget(self.postalCode, 3, 2, 1, 4)
        conGrid.addWidget(self.country, 4, 2, 1, 4)
Exemplo n.º 13
0
    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)
Exemplo n.º 14
0
    def __init__(self, settings, parent=None):
        super(SettingInput, self).__init__(parent)

        self.settings = settings

        self.formatComboBox = QComboBox(self)
        self.formatComboBox.addItem('INI')
        self.formatComboBox.addItem('Native')

        self.scopeComboBox = QComboBox(self)
        self.scopeComboBox.addItem('User')
        self.scopeComboBox.addItem('System')

        self.organizationComboBox = QComboBox(self)
        self.organizationComboBox.addItem('DAMGteam')
        self.organizationComboBox.setEditable(True)

        self.applicationComboBox = QComboBox(self)
        self.applicationComboBox.addItem('PLM')
        self.applicationComboBox.setEditable(True)
        self.applicationComboBox.setCurrentIndex(0)

        for cb in [
                self.formatComboBox, self.scopeComboBox,
                self.organizationComboBox, self.applicationComboBox
        ]:
            cb.currentIndexChanged.connect(self.updateLocationsTable)

        formatLabel = Label({
            'txt': "&Format: ",
            'setBuddy': self.formatComboBox
        })
        scopeLabel = Label({'txt': "&Scope:", 'setBuddy': self.scopeComboBox})
        organizationLabel = Label({
            'txt': "&Organization:",
            'setBuddy': self.organizationComboBox
        })
        applicationLabel = Label({
            'txt': "&Application:",
            'setBuddy': self.applicationComboBox
        })

        grpBox, grid = GroupGrid("Setting Locations")

        self.locationsTable = QTableWidget()
        self.locationsTable.setSelectionMode(QAbstractItemView.SingleSelection)
        self.locationsTable.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.locationsTable.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.locationsTable.setColumnCount(2)
        self.locationsTable.setHorizontalHeaderLabels(("Location", "Access"))
        self.locationsTable.horizontalHeader().setSectionResizeMode(
            0, QHeaderView.Stretch)
        self.locationsTable.horizontalHeader().resizeSection(1, 180)
        self.locationsTable.setMinimumHeight(180)

        self.formatComboBox.activated.connect(self.updateLocationsTable)
        self.scopeComboBox.activated.connect(self.updateLocationsTable)
        self.organizationComboBox.lineEdit().editingFinished.connect(
            self.updateLocationsTable)
        self.applicationComboBox.lineEdit().editingFinished.connect(
            self.updateLocationsTable)

        self.layout = QGridLayout()

        grid.addWidget(formatLabel, 1, 0)
        grid.addWidget(self.formatComboBox, 1, 1)
        grid.addWidget(scopeLabel, 2, 0)
        grid.addWidget(self.scopeComboBox, 2, 1)
        grid.addWidget(organizationLabel, 3, 0)
        grid.addWidget(self.organizationComboBox, 3, 1)
        grid.addWidget(applicationLabel, 4, 0)
        grid.addWidget(self.applicationComboBox, 4, 1)
        grid.addWidget(self.locationsTable, 0, 2, 6, 4)

        self.updateLocationsTable()
        self.layout.addWidget(grpBox)

        self.setLayout(self.layout)