示例#1
0
 def open_file_in_editor(cmd_to_open_editor, test_command=False):
     self.save_file_data(file_system_path)
     script_file_path = os.path.join(file_system_path, self.get_file_name())
     if not self.execute_shell_command_with_path(cmd_to_open_editor, script_file_path) and test_command:
         # If a text field exists destroy it. Errors can occur with a specified editor as well
         # e.g Permission changes or sth.
         global_gui_config.set_config_value('DEFAULT_EXTERNAL_EDITOR', None)
         global_gui_config.save_configuration()
         set_editor_lock_inline(False)
         return
     # Set the text on the button to 'Unlock' instead of 'Open externally'
     set_editor_lock_inline(True)
示例#2
0
 def open_text_window():
     markup_text = "No external editor specified. Please specify a shell command to open scripts externally"
     # create a new RAFCONButtonInputDialog, add a checkbox and add the text 'remember' to it
     text_input = RAFCONInputDialog(markup_text, ["Apply", "Cancel"], checkbox_text='remember', parent=True)
     # Run the text_input Dialog until a response is emitted. The apply button and the 'activate' signal of
     # the text input send response 1
     if text_input.run() == 1:
         # If the response emitted from the Dialog is 1 than handle the 'OK'
         # If the checkbox is activated, also save the text input into the config
         if text_input.get_checkbox_state():
             global_gui_config.set_config_value('DEFAULT_EXTERNAL_EDITOR', text_input.get_entry_text())
             global_gui_config.save_configuration()
         open_file_in_editor(text_input.get_entry_text(), test_command=True)
     else:
         # If Dialog is canceled either by the button or the cross, toggle back the button again
         # and revert the lock, which is not implemented yet
         set_editor_lock_inline(False)
     text_input.destroy()