Пример #1
0
    def get_setting(self):
        import os

        my_connector = Db_Connector(os.getcwd() + "/config.ini")
        mqtt_host = my_connector.get_value("serverconf", "host")
        print "mqtt_host:%s" % mqtt_host
        mqtt_port = my_connector.get_value("serverconf", "port")
        mqtt_topic = my_connector.get_value("serverconf", "topic")
        api_host = my_connector.get_value("serverconf", "api_host")
        api_port = my_connector.get_value("serverconf", "api_port")
        api_debug = my_connector.get_value("serverconf", "api_debug")
        edit_url = my_connector.get_value("serverconf", "edit_url")
        edit_pic_url = my_connector.get_value("serverconf", "edit_pic_url")
        self.txt_mqtt_host.setText(mqtt_host)
        self.txt_mqtt_port.setText(mqtt_port)
        self.txt_mqtt_topic.setText(mqtt_topic)

        self.txt_api_host.setText(api_host)
        self.txt_api_port.setText(api_port)
        self.cmb_api_debug.addItem(u"是", QtCore.QVariant(1))
        self.cmb_api_debug.addItem(u"否", QtCore.QVariant(0))
        index = self.cmb_api_debug.findData(QtCore.QVariant(int(api_debug)))
        self.cmb_api_debug.setCurrentIndex(index)

        self.txt_edit_url.setText(edit_url)
        self.txt_edit_pic_url.setText(edit_pic_url)
Пример #2
0
    def set_setting(self):
        import os

        my_connector = Db_Connector(os.getcwd() + "/config.ini")
        mqtt_host = my_connector.get_value("serverconf", "host")
        print "mqtt_host:%s" % mqtt_host

        mqtt_host = self.txt_mqtt_host.text()
        mqtt_port = self.txt_mqtt_port.text()
        mqtt_topic = self.txt_mqtt_topic.text()

        api_host = self.txt_api_host.text()
        api_port = self.txt_api_port.text()
        api_debug = self.cmb_api_debug.itemData(self.cmb_api_debug.currentIndex())

        edit_url = self.txt_edit_url.text()
        edit_pic_url = self.txt_edit_pic_url.text()

        my_connector.set_value("serverconf", "host", mqtt_host)
        my_connector.set_value("serverconf", "port", mqtt_port)
        my_connector.set_value("serverconf", "topic", mqtt_topic)
        my_connector.set_value("serverconf", "api_host", api_host)
        my_connector.set_value("serverconf", "api_port", api_port)
        my_connector.set_value("serverconf", "api_debug", api_debug)
        my_connector.set_value("serverconf", "edit_url", edit_url)
        my_connector.set_value("serverconf", "edit_pic_url", edit_pic_url)
Пример #3
0
    def createToolBoxEx(self):
        #查询菜单
         team_label  = {'项目管理':False,'系统管理':False,'简历管理':False,'日志管理':True}
         right_label = {'项目列表':False,'问题列表':False,'用户管理':False,'角色管理':False,'部门管理':False,'岗位管理':False,'简历列表':False,'招聘管理':False,'日志列表':True}

         #查询当前需要设置的权限
         cur_path = os.getcwd()
         my_connector = Db_Connector(cur_path+'/Config.ini')
         cur_team_label = my_connector.get_value_right_team()
         cur_team_label = cur_team_label.split(',')

         cur_right_label = my_connector.get_value_right_lab()
         cur_right_label = cur_right_label.split(',')

         cur_right = my_connector.get_value_right()
         cur_right = cur_right.split(',')

         if 0< len(cur_team_label):
             for item in cur_team_label:
                 if item in team_label:
                     team_label[item] = True

         if 0< len(cur_right_label):
             for item in cur_right_label:
                 if item in right_label:
                     right_label[item] = True

         print team_label
         print right_label
         #查询当前需要设置的权限

         if team_label['项目管理']:
             #########项目管理
             backgroundLayout = QtGui.QGridLayout()
             row = 0
             if right_label['项目列表']:
                backgroundLayout.addWidget(self.createBackgroundCellWidget(u"项目列表",
                        ':/images/background1.png'), row, 0)
                row += 1

             if right_label['问题列表']:
                backgroundLayout.addWidget(self.createBackgroundCellWidget(u"问题列表",
                        ':/images/background2.png'), row, 0)

             backgroundLayout.setRowStretch(2, 10)
             backgroundLayout.setColumnStretch(2, 10)

             backgroundWidget = QtGui.QWidget()
             backgroundWidget.setLayout(backgroundLayout)

             self.toolBox.addItem(backgroundWidget, u"项目管理")
             #########项目管理

         if team_label['系统管理']:
             #########系统管理
             backgroundLayout = QtGui.QGridLayout()
             row = 0
             if right_label['用户管理']:
                backgroundLayout.addWidget(self.createBackgroundCellWidget(u"用户管理",
                        ':/images/background1.png'), row, 0)
                row += 1

             if right_label['角色管理']:
                backgroundLayout.addWidget(self.createBackgroundCellWidget(u"角色管理",
                          ':/images/background2.png'), row, 0)
                row += 1

             if right_label['部门管理']:
                backgroundLayout.addWidget(self.createBackgroundCellWidget(u"部门管理",
                        ':/images/background2.png'), row, 0)

             backgroundLayout.setRowStretch(3, 10)
             backgroundLayout.setColumnStretch(2, 10)

             backgroundWidget = QtGui.QWidget()
             backgroundWidget.setLayout(backgroundLayout)

             self.toolBox.addItem(backgroundWidget, u"系统管理")
             #########系统管理

         if team_label['简历管理']:
             #########日志管理
             backgroundLayout = QtGui.QGridLayout()
             row = 0
             if right_label['简历列表']:
                backgroundLayout.addWidget(self.createBackgroundCellWidget(u"简历列表",
                        ':/images/background1.png'), row, 0)
                row += 1

             if right_label['招聘管理']:
                backgroundLayout.addWidget(self.createBackgroundCellWidget(u"招聘管理",
                        ':/images/background2.png'), row, 0)

             backgroundLayout.setRowStretch(2, 10)
             backgroundLayout.setColumnStretch(2, 10)

             backgroundWidget = QtGui.QWidget()
             backgroundWidget.setLayout(backgroundLayout)

             self.toolBox.addItem(backgroundWidget, u"简历管理")

        #########日志管理
         backgroundLayout = QtGui.QGridLayout()
         backgroundLayout.addWidget(self.createBackgroundCellWidget(u"日志列表",
                    ':/images/background1.png'), 0, 0)

         backgroundLayout.setRowStretch(2, 10)
         backgroundLayout.setColumnStretch(2, 10)

         backgroundWidget = QtGui.QWidget()
         backgroundWidget.setLayout(backgroundLayout)

         self.toolBox.addItem(backgroundWidget, u"日志管理")
Пример #4
0
    def my_login(self):
        import sys
        #登录逻辑处理模块
        user_name    = self.t_name.text()
        passwd  = self.t_password.text()
        self.user_name = user_name
        self.passwd    = passwd
        my_business = business()
        (message,status,admin_id,role_id,part_id) = my_business.login(self.user_name, self.passwd)
        if status:
            #发送成功消息
            self.parent.set_message(u'提示',message)
            self.parent.set_tray(1)
            #查询我的bug
            (status,is_success,message) = my_business.get_my_bug(admin_id)
            #500,,参数错误 | 200,0,严重错误 | 200,1,一般错误 | 200,-1,没有错误 | 其他查询失败
            if 500 == status:#500,,参数错误
                pass
            elif 200 == status and 0 == is_success:#200,0,严重错误
                pass
            elif 200 == status and 1 == is_success:#200,1,一般错误
                pass
            elif 200 == status and -1 == is_success:#200,-1,没有错误
                pass
            else:
                pass

            #查询权限
            (status,content) = my_business.get_right(int(role_id))
            if status:
                #写权限
                right = content['resource']
                my_Connector = Db_Connector(os.getcwd()+'/config.ini')
                my_Connector.set_value_right(right)
                #写权限及其组权限
                team = {1:'项目管理',2:'系统管理',3:'简历管理'}
                where = {'id':['in',str(content['resource'])]}
                right_label = []
                team_label  = []
                team_label_str = []
                (status,content) = my_business.get_resource_where(where)
                if status:
                    rows = int(content['record_count'])
                    if 0<rows:
                        for row in range(0,rows):
                            if content['list'][row]['name'] not in right_label:
                                right_label.append(content['list'][row]['name'])
                                if content['list'][row]['team_name'] not in team_label:
                                    team_label.append(int(content['list'][row]['team_name']))
                        #写right_label权限
                        my_Connector.set_value_right_label(','.join(right_label))
                        #写组
                        if 0<len(team_label):
                            for item in team_label:
                                team_label_str.append(str(team[item]))
                            my_Connector.set_value_right_team(','.join(team_label_str))
                            self.accept()
            else:
                self.parent.set_message(u'错误',content)
                return
        else:
            #发送错误消息
            self.parent.set_message(u'错误',message)
            return