Пример #1
0
 def eqrun_menu(self, pos):
     # 返回调用者的对象
     sender_widget = self.sender()
     menu = QMenu()
     button1 = menu.addAction("编辑运行记录")
     button2 = menu.addAction("复制运行记录")
     button3 = menu.addAction("删除运行记录")
     global_pos = sender_widget.mapToGlobal(pos)
     action = menu.exec(global_pos)
     select_items = sender_widget.selectedItems()
     autoid_list = []
     for item in select_items:
         autoid_list.append(int(item.text(0)))
     if len(select_items):
         EC = EquipmentController()
         # 编辑运行记录
         if action == button1:
             current_item = sender_widget.currentItem().text(0)
             id = int(current_item.text(0))
             eqrun_detail = EqrunnoteModule(autoid=id,
                                            edit=True,
                                            parent=self)
             eqrun_detail.accepted.connect(self.get_equiprunnote)
             res = eqrun_detail.show()
         # 复制运行记录
         elif action == button2:
             EC.insert_equip_run_note(autoid_list)
             self.get_equiprunnote()
         # 删除运行记录
         elif action == button3:
             EC.delete_equip_run_note(autoid_list)
             self.get_equiprunnote()
Пример #2
0
 def eqrun_menu(self, pos):
     if self.is_view:
         return
     # 返回调用者的对象
     sender_widget = self.sender()
     menu = QMenu()
     button1 = menu.addAction("编辑运行记录")
     button2 = menu.addAction("复制运行记录")
     button3 = menu.addAction("删除运行记录")
     global_pos = sender_widget.mapToGlobal(pos)
     action = menu.exec(global_pos)
     select_items = sender_widget.selectedItems()
     autoid_list = []
     for item in select_items:
         autoid_list.append(int(item.text(0)))
     if len(select_items):
         EC = EquipmentController()
         # 编辑运行记录
         if action == button1:
             eqrun_detail = EqrunnoteModule(
                 autoid=sender_widget.currentItem().text(0),
                 edit=not self.is_view,
                 parent=self)
             res = eqrun_detail.exec()
         # 复制运行记录
         elif action == button2:
             res = EC.insert_equip_run_note(autoid_list)
         # 删除运行记录
         elif action == button3:
             res = EC.delete_equip_run_note(autoid_list)
         if res:
             self.get_equiprunnote()