Esempio n. 1
0
    def __init__(self):
        View.__init__(self, parent='history_vbox')
        Gtk.ScrolledWindow.__init__(self)

        history_tree = ExecutionHistoryTreeView()

        reload_button = Gtk.Button.new_with_label("Reload")
        reload_button.set_border_width(constants.BUTTON_BORDER_WIDTH)
        clean_button = Gtk.Button.new_with_label("Clean")
        clean_button.set_border_width(constants.BUTTON_BORDER_WIDTH)
        open_separately_button = Gtk.Button.new_with_label("Open externally")
        open_separately_button.set_border_width(constants.BUTTON_BORDER_WIDTH)

        button_box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0)
        button_box.get_style_context().add_class("widget-toolbar")
        button_box.pack_end(reload_button, False, True, 0)
        button_box.pack_end(clean_button, False, True, 0)
        button_box.pack_end(open_separately_button, False, True, 0)

        label.ellipsize_labels_recursively(button_box)

        history_vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        history_vbox.pack_end(button_box, False, True, 0)
        history_vbox.pack_end(self, True, True, 0)

        self.add(history_tree)
        self.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        self.show_all()

        self['history_vbox'] = history_vbox
        self['history_view'] = self
        self['history_tree'] = history_tree
        self['reload_button'] = reload_button
        self['clean_button'] = clean_button
        self['open_separately_button'] = open_separately_button
Esempio n. 2
0
    def __init__(self):
        super().__init__(builder_filename=glade.get_glade_path(
            'semantic_data_editor.glade'),
                         parent='semantic_data_vbox')
        self.scrollbar_widget = self['semantic_data_scroller']
        self['delete_entry'].set_border_width(constants.BUTTON_BORDER_WIDTH)
        self['new_dict_entry'].set_border_width(constants.BUTTON_BORDER_WIDTH)
        self['new_entry'].set_border_width(constants.BUTTON_BORDER_WIDTH)
        tree_view = self["semantic_data_tree_view"]

        # prepare tree view columns
        key_renderer = Gtk.CellRendererText()
        key_renderer.set_property('editable', True)
        col = Gtk.TreeViewColumn('Key', key_renderer, text=self.KEY_STORAGE_ID)
        tree_view.append_column(col)

        value_renderer = Gtk.CellRendererText()
        value_renderer.set_property('editable', True)
        col = Gtk.TreeViewColumn('Value',
                                 value_renderer,
                                 text=self.VALUE_STORAGE_ID)
        tree_view.append_column(col)

        is_dict_renderer = Gtk.CellRendererText()
        col = Gtk.TreeViewColumn('Is Dict',
                                 is_dict_renderer,
                                 text=self.IS_DICT_STORAGE_ID)
        tree_view.append_column(col)

        gui_helper_label.ellipsize_labels_recursively(
            self['semantic_data_toolbar'])
Esempio n. 3
0
    def __init__(self):
        View.__init__(self)

        self._lock = threading.Lock()

        ######################################################
        # Logging text view
        ######################################################
        self.logging_console_view = LoggingConsoleView()
        self['console'].pack_start(self.logging_console_view.get_top_widget(), True, True, 0)
        self.logging_console_view.get_top_widget().show()

        ######################################################
        # initial configuration of the console
        ######################################################
        self['button_follow_logging'].set_active(global_gui_config.get_config_value('CONSOLE_FOLLOW_LOGGING', True))
        self['button_show_verbose'].set_active(global_gui_config.get_config_value('LOGGING_SHOW_VERBOSE', True))
        self['button_show_debug'].set_active(global_gui_config.get_config_value('LOGGING_SHOW_DEBUG', True))
        self['button_show_info'].set_active(global_gui_config.get_config_value('LOGGING_SHOW_INFO', True))
        self['button_show_warning'].set_active(global_gui_config.get_config_value('LOGGING_SHOW_WARNING', True))
        self['button_show_error'].set_active(global_gui_config.get_config_value('LOGGING_SHOW_ERROR', True))

        self['undock_console_button'].set_image(gui_helper_label.create_button_label(constants.BUTTON_UNDOCK))
        self['undock_console_button'].set_tooltip_text("Undock debug console widget")
        self['console_hide_button'].set_image(gui_helper_label.create_button_label(constants.BUTTON_DOWNA))

        gui_helper_label.ellipsize_labels_recursively(self['debug_console_button_hbox'])
Esempio n. 4
0
    def __init__(self):
        View.__init__(self)

        self['new_global_variable_button'].set_border_width(constants.BUTTON_BORDER_WIDTH)
        self['delete_global_variable_button'].set_border_width(constants.BUTTON_BORDER_WIDTH)
        self['lock_global_variable_button'].set_border_width(constants.BUTTON_BORDER_WIDTH)
        self['unlock_global_variable_button'].set_border_width(constants.BUTTON_BORDER_WIDTH)
        self.scrollbar_widget = self['scroller']

        label.ellipsize_labels_recursively(self['global_variables_toolbar'])
Esempio n. 5
0
    def __init__(self):
        View.__init__(self)

        self.data_flows_listView = StateDataFlowsListView()
        self['data_flows_scroller'].add(self.data_flows_listView.get_top_widget())
        self.data_flows_listView.scrollbar_widget = self['data_flows_scroller']

        self['internal_d_checkbutton'].set_border_width(constants.BUTTON_BORDER_WIDTH)
        self['connected_to_d_checkbutton'].set_border_width(constants.BUTTON_BORDER_WIDTH)
        self['add_d_button'].set_border_width(constants.BUTTON_BORDER_WIDTH)
        self['remove_d_button'].set_border_width(constants.BUTTON_BORDER_WIDTH)

        gui_helper_label.ellipsize_labels_recursively(self['data_flows_toolbar'])
Esempio n. 6
0
 def __init__(self):
     super().__init__(builder_filename=glade.get_glade_path(
         'global_variable_editor_widget.glade'),
                      parent='global_variable_vbox')
     self['new_global_variable_button'].set_border_width(
         constants.BUTTON_BORDER_WIDTH)
     self['delete_global_variable_button'].set_border_width(
         constants.BUTTON_BORDER_WIDTH)
     self['lock_global_variable_button'].set_border_width(
         constants.BUTTON_BORDER_WIDTH)
     self['unlock_global_variable_button'].set_border_width(
         constants.BUTTON_BORDER_WIDTH)
     self.scrollbar_widget = self['scroller']
     label.ellipsize_labels_recursively(self['global_variables_toolbar'])
Esempio n. 7
0
    def __init__(self):
        View.__init__(self)
        Gtk.ScrolledWindow.__init__(self)

        history_tree = HistoryTreeView()
        history_tree.set_name('history_tree')

        undo_button = Gtk.Button.new_with_label("Undo")
        undo_button.set_border_width(constants.BUTTON_BORDER_WIDTH)
        redo_button = Gtk.Button.new_with_label("Redo")
        redo_button.set_border_width(constants.BUTTON_BORDER_WIDTH)
        reset_button = Gtk.Button.new_with_label("Reset")
        reset_button.set_border_width(constants.BUTTON_BORDER_WIDTH)
        branch_checkbox = Gtk.CheckButton.new_with_label("Branches")
        branch_checkbox.set_tooltip_text('Show branches')
        branch_checkbox.set_border_width(constants.BUTTON_BORDER_WIDTH)
        branch_checkbox.get_style_context().add_class("secondary")
        folded_checkbox = Gtk.CheckButton.new_with_label("Fold")
        folded_checkbox.set_tooltip_text('Fold branches')
        folded_checkbox.set_border_width(constants.BUTTON_BORDER_WIDTH)
        folded_checkbox.get_style_context().add_class("secondary")

        button_hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0)
        button_hbox.get_style_context().add_class("widget-toolbar")
        button_hbox.pack_end(folded_checkbox, False, True, 0)
        button_hbox.pack_end(branch_checkbox, False, True, 0)
        button_hbox.pack_end(reset_button, False, True, 0)
        button_hbox.pack_end(redo_button, False, True, 0)
        button_hbox.pack_end(undo_button, False, True, 0)

        label.ellipsize_labels_recursively(button_hbox)

        history_vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        history_vbox.pack_start(self, True, True, 0)
        history_vbox.pack_start(button_hbox, False, True, 0)

        self.add(history_tree)
        self.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        self.show_all()

        self['history_vbox'] = history_vbox
        self['history_view'] = self
        self['history_tree'] = history_tree
        self['undo_button'] = undo_button
        self['redo_button'] = redo_button
        self['reset_button'] = reset_button
        self['branch_checkbox'] = branch_checkbox
        self['folded_checkbox'] = folded_checkbox
        self.top = 'history_vbox'
Esempio n. 8
0
    def __init__(self):
        super().__init__(parent='notification_bar')

        self['notification_bar'] = self.notification_bar = Gtk.Revealer()
        self.notification_bar.set_transition_type(Gtk.RevealerTransitionType.SLIDE_UP)
        self.notification_bar.set_transition_duration(400)

        self.info_bar = Gtk.InfoBar()
        self.info_bar.set_show_close_button(True)
        self.notification_bar.add(self.info_bar)

        self._message_label = Gtk.Label(label="test")
        content_area = self.info_bar.get_content_area()
        content_area.add(self._message_label)
        label.ellipsize_labels_recursively(content_area)
Esempio n. 9
0
 def __init__(self):
     super().__init__(builder_filename=glade.get_glade_path(
         'state_data_flows_widget.glade'),
                      parent='data_flows_container')
     self.data_flows_listView = StateDataFlowsListView()
     self['data_flows_scroller'].add(
         self.data_flows_listView.get_parent_widget())
     self.data_flows_listView.scrollbar_widget = self['data_flows_scroller']
     self['internal_d_checkbutton'].set_border_width(
         constants.BUTTON_BORDER_WIDTH)
     self['connected_to_d_checkbutton'].set_border_width(
         constants.BUTTON_BORDER_WIDTH)
     self['add_d_button'].set_border_width(constants.BUTTON_BORDER_WIDTH)
     self['remove_d_button'].set_border_width(constants.BUTTON_BORDER_WIDTH)
     gui_helper_label.ellipsize_labels_recursively(
         self['data_flows_toolbar'])
Esempio n. 10
0
    def __init__(self):
        super().__init__(builder_filename=glade.get_glade_path('main_window.glade'), parent='main_window')

        if os.getenv("RAFCON_START_MINIMIZED", False):
            self.get_parent_widget().iconify()

        # Add gui components by removing their corresponding placeholders defined in the glade file first and then
        # adding the widgets.
        self.left_bar_notebooks = [self['upper_notebook'], self['lower_notebook']]

        ################################################
        # Undock Buttons
        ################################################
        self['undock_left_bar_button'].set_image(gui_helper_label.create_button_label(constants.BUTTON_UNDOCK))
        self['undock_left_bar_button'].set_tooltip_text("Undock left side bar widget")
        self['undock_right_bar_button'].set_image(gui_helper_label.create_button_label(constants.BUTTON_UNDOCK))
        self['undock_right_bar_button'].set_tooltip_text("Undock right side bar widget")
        self['collapse_tree_button'].set_image(gui_helper_label.create_button_label(constants.ICON_TREE_FOLD))
        self['collapse_tree_button'].set_tooltip_text("Collapse tree of widget")
        self['show_search_bar'].set_image(gui_helper_label.create_button_label(constants.BUTTON_SHOW_SEARCH_BAR))
        self['show_search_bar'].set_tooltip_text("Show state machine search bar")

        ######################################################
        # Library Tree
        ######################################################
        self.library_tree = LibraryTreeView()
        self.library_tree.show()
        self['libraries_scrolledwindow'].add(self.library_tree)

        ######################################################
        # Library Usages Tree
        ######################################################
        self.library_usages_tree = LibraryTreeView()
        self.library_usages_tree.show()
        self['library_usages_scrolledwindow'].add(self.library_usages_tree)

        ######################################################
        # State Icons
        ######################################################
        self.state_icons = StateIconView()
        self.state_icons.show()
        self["state_icons_box"].pack_start(self.state_icons.get_parent_widget(), True, True, 0)

        ######################################################
        # State Machine Tree
        ######################################################
        self.state_machine_tree = StateMachineTreeView()
        self.state_machine_tree.show()
        self['states_tree_scrolledwindow'].add(self.state_machine_tree)

        ######################################################
        # Global Variable Manager
        ######################################################
        self.global_var_editor = GlobalVariableEditorView()
        self.global_var_editor.show()
        self['global_variables_eventbox'].add(self.global_var_editor.get_parent_widget())

        ######################################################
        # State Machine History
        ######################################################
        self.state_machine_history = ModificationHistoryView()
        self.state_machine_history.show()
        self['history_alignment'].add(self.state_machine_history.get_parent_widget())

        ######################################################
        # State Machine Execution History
        ######################################################
        self.execution_history = ExecutionHistoryView()
        self.execution_history.show()
        self['execution_history_alignment'].add(self.execution_history.get_parent_widget())

        ######################################################
        # rotate all tab labels by 90 degrees and make detachable
        ######################################################
        self.rotate_and_detach_tab_labels()

        self['upper_notebook'].set_current_page(0)
        self['lower_notebook'].set_current_page(0)

        ######################################################
        # State-machines-editor (graphical)
        ######################################################
        self.state_machines_editor = StateMachinesEditorView()
        self.state_machines_editor.show()
        self['central_vbox'].pack_start(self.state_machines_editor.get_parent_widget(), True, True, 0)
        self['central_vbox'].reorder_child(self.state_machines_editor.get_parent_widget(), 1)

        ######################################################
        # Notification Bar
        ######################################################
        self.notification_bar = NotificationBarView()
        self.notification_bar.show()
        self['central_vbox'].pack_start(self.notification_bar.get_parent_widget(), False, True, 0)
        self['central_vbox'].reorder_child(self.notification_bar.get_parent_widget(), 2)

        ######################################################
        # States-editor
        ######################################################
        self.states_editor = StatesEditorView()
        self['state_editor_eventbox'].add(self.states_editor.get_parent_widget())
        self.states_editor.show()

        ######################################################
        # Debug Console
        ######################################################
        self.debug_console_view = DebugConsoleView()
        self['debug_console_viewport'].add(self.debug_console_view.get_parent_widget())
        self.debug_console_view.get_parent_widget().show()
        # map hide and undock buttons within and debug widget to be usable from main window view with generic naming
        self['undock_console_button'] = self.debug_console_view['undock_console_button']
        self['console_hide_button'] = self.debug_console_view['console_hide_button']
        self['console_container'] = self.debug_console_view['console_container']
        self['console'] = self.debug_console_view['console']

        ##################################################
        # HeaderBar with MenuBar
        ##################################################

        self.menu_bar = MenuBarView()
        self.menu_bar.show()

        self['headerbar'].pack_start(self.menu_bar.get_parent_widget())
        self['headerbar'].show()

        self.tool_bar = ToolBarView()
        self.tool_bar.show()
        self['top_level_vbox'].remove(self['tool_bar_placeholder'])
        self['top_level_vbox'].pack_start(self.tool_bar.get_parent_widget(), expand=False, fill=True, padding=0)
        self['top_level_vbox'].reorder_child(self.tool_bar.get_parent_widget(), 0)

        ################################################
        # Hide Buttons
        ################################################
        self['left_bar_hide_button'].set_image(gui_helper_label.create_button_label(constants.BUTTON_LEFTA))
        self['right_bar_hide_button'].set_image(gui_helper_label.create_button_label(constants.BUTTON_RIGHTA))

        ################################################
        # Return Buttons
        ################################################
        self['left_bar_return_button'].set_image(gui_helper_label.create_button_label(constants.BUTTON_RIGHTA))
        self['right_bar_return_button'].set_image(gui_helper_label.create_button_label(constants.BUTTON_LEFTA))
        self['console_return_button'].set_image(gui_helper_label.create_button_label(constants.BUTTON_UPA))

        # --------------------------------------------------------------------------
        # Edit graphical_editor_shortcuts
        # --------------------------------------------------------------------------

        button_start_shortcut = self['button_start_shortcut']
        button_start_shortcut.set_tooltip_text('Run')
        button_stop_shortcut = self['button_stop_shortcut']
        button_stop_shortcut.set_tooltip_text('Stop')
        button_pause_shortcut = self['button_pause_shortcut']
        button_pause_shortcut.set_tooltip_text('Pause')
        button_run_this_state_shortcut = self['button_run_this_state_shortcut']
        button_run_this_state_shortcut.set_tooltip_text('Run Selected State')
        button_run_only_this_state_shortcut = self['button_run_only_this_state_shortcut']
        button_run_only_this_state_shortcut.set_tooltip_text('Only Run Selected State')
        button_start_from_shortcut = self['button_start_from_shortcut']
        button_start_from_shortcut.set_tooltip_text('Run From Selected State')
        button_run_to_shortcut = self['button_run_to_shortcut']
        button_run_to_shortcut.set_tooltip_text('Run Until Selected State (Selected State Excluded)')
        button_step_mode_shortcut = self['button_step_mode_shortcut']
        button_step_mode_shortcut.set_tooltip_text('Enter Step Mode')
        button_step_in_shortcut = self['button_step_in_shortcut']
        button_step_in_shortcut.set_tooltip_text('Step Into (One Level In -> Child-State))')
        button_step_over_shortcut = self['button_step_over_shortcut']
        button_step_over_shortcut.set_tooltip_text('Step Over (the next Sibling-State))')
        button_step_out_shortcut = self['button_step_out_shortcut']
        button_step_out_shortcut.set_tooltip_text('Step Out (One Level Up -> Parent-State)')
        button_step_backward_shortcut = self['button_step_backward_shortcut']
        button_step_backward_shortcut.set_tooltip_text('Step Backward')

        button_start_shortcut.set_label_widget(gui_helper_label.create_button_label(constants.BUTTON_START))
        button_stop_shortcut.set_label_widget(gui_helper_label.create_button_label(constants.BUTTON_STOP))
        button_pause_shortcut.set_label_widget(gui_helper_label.create_button_label(constants.BUTTON_PAUSE))
        button_run_this_state_shortcut.set_label_widget(gui_helper_label.create_button_label(constants.BUTTON_RUN_SELECTED_STATE))
        button_run_only_this_state_shortcut.set_label_widget(gui_helper_label.create_button_label(constants.BUTTON_ONLY_RUN_SELECTED_STATE))
        button_start_from_shortcut.set_label_widget(gui_helper_label.create_button_label(constants.BUTTON_START_FROM_SELECTED_STATE))
        button_run_to_shortcut.set_label_widget(gui_helper_label.create_button_label(constants.BUTTON_RUN_TO_SELECTED_STATE))
        button_step_mode_shortcut.set_label_widget(gui_helper_label.create_button_label(constants.BUTTON_STEPM))
        button_step_in_shortcut.set_label_widget(gui_helper_label.create_button_label(constants.BUTTON_STEP_INTO))
        button_step_over_shortcut.set_label_widget(gui_helper_label.create_button_label(constants.BUTTON_STEP_OVER))
        button_step_out_shortcut.set_label_widget(gui_helper_label.create_button_label(constants.BUTTON_STEP_OUT))
        button_step_backward_shortcut.set_label_widget(gui_helper_label.create_button_label(constants.BUTTON_BACKW))

        self.left_bar_window = UndockedWindowView('left_bar_window')
        self.right_bar_window = UndockedWindowView('right_bar_window')
        self.console_window = UndockedWindowView('console_window')

        gui_helper_label.ellipsize_labels_recursively(self['execution_ticker_text'], Pango.EllipsizeMode.START)
Esempio n. 11
0
    def __init__(self):
        super(SourceEditorView,
              self).__init__(name='SOURCE EDITOR',
                             language='python',
                             editor_style="SOURCE_EDITOR_STYLE",
                             run_with_spacer=False)

        try:
            if isinstance(self.textview, GtkSource.View):
                self.textview.set_tab_width(4)
                self.textview.set_insert_spaces_instead_of_tabs(True)
                self.textview.set_show_line_numbers(True)
                self.textview.set_auto_indent(True)
                self.textview.set_highlight_current_line(True)
        except NameError:
            pass
        hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0)
        hbox.get_style_context().add_class("widget-toolbar")
        pylint_check_button = Gtk.CheckButton(label="Validate")
        pylint_check_button.set_focus_on_click(False)
        pylint_check_button.set_border_width(constants.BUTTON_BORDER_WIDTH)
        pylint_check_button.get_style_context().add_class("secondary")

        open_external_button = Gtk.ToggleButton(label="Open externally")
        open_external_button.set_focus_on_click(False)
        open_external_button.set_border_width(constants.BUTTON_BORDER_WIDTH)

        apply_button = Gtk.Button(label="Apply")
        apply_button.set_focus_on_click(False)
        apply_button.set_border_width(constants.BUTTON_BORDER_WIDTH)

        cancel_button = Gtk.Button(label="Reset")
        cancel_button.set_focus_on_click(False)
        cancel_button.set_border_width(constants.BUTTON_BORDER_WIDTH)

        hbox.pack_start(pylint_check_button, False, False, 0)
        hbox.pack_end(open_external_button, False, True, 0)
        hbox.pack_end(cancel_button, False, True, 0)
        hbox.pack_end(apply_button, False, True, 0)

        label.ellipsize_labels_recursively(hbox)

        self['editor_frame'].pack_start(hbox,
                                        expand=False,
                                        fill=True,
                                        padding=0)
        self['pylint_check_button'] = pylint_check_button
        self['apply_button'] = apply_button
        self['open_external_button'] = open_external_button
        self['cancel_button'] = cancel_button

        # TODO find the properties where the the next three values can be read from
        # value is an assumption because its respective property is not found till now
        self.line_numbers_width = 35
        # this value is from the main window glade file and respective right_bar_container width request
        self.tab_width = 53
        # value is an assumption because its respective property is not found till now
        self.source_view_character_size = 8
        # observe key press events to adapt pane position
        # Note: -> changed is not used because it is creating glib segfaults
        if self.spacer_frame is not None:
            self.textview.connect("key-press-event", self.on_text_view_event)