예제 #1
0
 def on_lineEdit_supname_textChanged(self, p_str):
     self.lineEdit_inputcode.setText(Inputcode.make_inputcode(p_str))
     try:
         if p_str != self.ori_detail['supname']:
             self.new_detail['supname'] = p_str
         else:
             try:
                 del self.new_detail['supname']
             except KeyError:
                 pass
     except KeyError:
         self.new_detail['supname'] = p_str
예제 #2
0
 def on_clerkname_textChanged(self, p_str):
     # 把人员名称拼音关联到输入码
     self.inputcode.setText(Inputcode.make_inputcode(p_str))
     try:
         if p_str != self.ori_detail['clerkname']:
             self.new_detail['clerkname'] = p_str
         else:
             try:
                 del self.new_detail['clerkname']
             except KeyError:
                 pass
     except KeyError:
         self.new_detail['clerkname'] = p_str
예제 #3
0
    def on_treeWidget_kind_customContextMenuRequested(self, pos):
        if self.power[1] == '0':
            return
        sender_widget = self.sender()
        current_item = sender_widget.currentItem()
        menu = QMenu()
        button1 = menu.addAction("增加分类")
        button2 = menu.addAction("修改分类")
        button3 = menu.addAction("删除分类")
        global_pos = sender_widget.mapToGlobal(pos)
        action = menu.exec(global_pos)
        if action == button1:
            if current_item is None:
                parent_item = self.treeWidget_kind.topLevelItem(0)
            else:
                parent_item = current_item
            parent_id = int(parent_item.text(1))
            kwargs = {
                'kind': 4,
                'kindname': "新建分类",
                'parentid': parent_id,
                'inputcode': Inputcode.make_inputcode("新建分类")
            }
            kind_object = self.SC.update_data(4, **kwargs)
            qtreeitem = QTreeWidgetItem(parent_item)
            qtreeitem.setText(0, "新建分类")
            qtreeitem.setText(1, str(kind_object.autoid))

            self.treeWidget_kind.openPersistentEditor(qtreeitem, 0)
            self.treeWidget_kind.setCurrentItem(qtreeitem)
        elif action == button2:
            if current_item is None:
                return
            self.treeWidget_kind.setCurrentItem(None)
            self.treeWidget_kind.openPersistentEditor(current_item, 0)
            self.treeWidget_kind.setCurrentItem(current_item, 0)

        elif action == button3:
            if current_item is None:
                return
            id = int(current_item.text(1))
            condition = {'autoid': id}
            self.SC.delete_data(4, condition)
            self.get_kind_list()