Esempio n. 1
0
 def set_logic(self):
     if len(self.selectedItems()) < 1:
         return
     item = self.item(self.selectedItems()[0].row(), 0)
     inp = InputMultilineDialog().input('insert logic', input_content=item.get_hook_data().get_logic())
     if inp[0]:
         if self.app.get_script().exports.hooklogic(item.get_hook_data().get_ptr(), inp[1]):
             item.get_hook_data().set_logic(inp[1])
Esempio n. 2
0
    def set_logic(self, item):
        item = self.item(item.row(), 0)
        inp = InputMultilineDialog().input(
            'insert logic', input_content=item.get_hook_data().get_logic())

        what = item.get_hook_data().get_ptr()
        if what == 0:
            what = item.get_hook_data().get_input()
        if self.app.dwarf_api('setHookLogic', [what, inp[1]]):
            item.get_hook_data().set_logic(inp[1])
Esempio n. 3
0
 def _on_modify_logic(self, num_row):
     item = self._hooks_model.item(num_row, 3)
     data = item.data(Qt.UserRole + 2)
     if data is None:
         data = ''
     ptr = self._hooks_model.item(num_row, 0).text()
     accept, input_ = InputMultilineDialog().input(
         'Insert logic for %s' % ptr, input_content=data)
     if accept:
         what = utils.parse_ptr(ptr)
         if what == 0:
             what = self._hooks_model.item(num_row, 2).data(Qt.UserRole + 2)
         if self._app_window.dwarf.dwarf_api('setHookLogic', [what, input_]):
             item.setData(input_, Qt.UserRole + 2)
             if not item.text():
                 item.setText('ƒ')
             item.setToolTip(input_)
             self.onHookChanged.emit(ptr)