Example #1
0
class SettingWorkspace(QtGui.QWidget):
    bg_color = QtGui.QColor(150, 150, 200)

    def __init__(self, parent=None):
        super(SettingWorkspace, self).__init__(parent)
        self.settings = dict()

        self.main_layout = QtGui.QHBoxLayout()
        self.main_layout.setContentsMargins(0, 0, 0, 0)
        self.main_layout.setSpacing(0)
        self.setLayout(self.main_layout)

        self.nav_bar = SettingNavBar()
        self.nav_bar.buttonClicked.connect(self.switch_setting)
        self.main_layout.addWidget(self.nav_bar)
        self.setting_area = QtGui.QStackedWidget()
        self.main_layout.addWidget(self.setting_area)

        self.add_setting_group(u"通用设置")
        self.add_setting_area(UserSetting())
        self.add_setting_area(TaskTypeSetting())

    def add_setting_group(self, group_name):
        self.nav_bar.add_group(SettingGroup(group_name))

    def add_setting_area(self, set_area):
        self.nav_bar.add_button(set_area.setting_button())
        self.setting_area.addWidget(set_area)
        self.settings[set_area.name] = set_area

    def switch_setting(self, name):
        print name
        self.setting_area.setCurrentWidget(self.settings[name])
Example #2
0
    def __init__(self, parent=None):
        super(SettingWorkspace, self).__init__(parent)
        self.settings = dict()

        self.main_layout = QtGui.QHBoxLayout()
        self.main_layout.setContentsMargins(0, 0, 0, 0)
        self.main_layout.setSpacing(0)
        self.setLayout(self.main_layout)

        self.nav_bar = SettingNavBar()
        self.nav_bar.buttonClicked.connect(self.switch_setting)
        self.main_layout.addWidget(self.nav_bar)
        self.setting_area = QtGui.QStackedWidget()
        self.main_layout.addWidget(self.setting_area)

        self.add_setting_group(u"通用设置")
        self.add_setting_area(UserSetting())
        self.add_setting_area(TaskTypeSetting())