Пример #1
0
    def __init__(self):
        View.__init__(self)
        Gtk.TreeView.__init__(self)
        self.set_name('state_machine_tree')

        tvcolumn = Gtk.TreeViewColumn('Name')
        tvcolumn.set_property("sizing", Gtk.TreeViewColumnSizing.AUTOSIZE)
        # tvcolumn.set_min_width(150)
        self.append_column(tvcolumn)
        cell = Gtk.CellRendererText()
        tvcolumn.pack_start(cell, True)
        tvcolumn.add_attribute(cell, 'text', 0)
        tvcolumn.set_sort_column_id(0)

        tvcolumn = Gtk.TreeViewColumn('ID')
        tvcolumn.set_property("sizing", Gtk.TreeViewColumnSizing.AUTOSIZE)
        # tvcolumn.set_min_width(150)
        self.append_column(tvcolumn)
        cell = Gtk.CellRendererText()
        tvcolumn.pack_start(cell, True)
        tvcolumn.add_attribute(cell, 'text', 1)
        tvcolumn.set_sort_column_id(1)

        tvcolumn = Gtk.TreeViewColumn('Type')
        tvcolumn.set_property("sizing", Gtk.TreeViewColumnSizing.AUTOSIZE)
        # tvcolumn.set_min_width(150)
        self.append_column(tvcolumn)
        cell = Gtk.CellRendererText()
        tvcolumn.pack_start(cell, True)
        tvcolumn.add_attribute(cell, 'text', 2)
        tvcolumn.set_sort_column_id(2)

        self['state_machine_tree_view'] = self
        self.top = 'state_machine_tree_view'
Пример #2
0
    def __init__(self, selection_m):
        """View holding the graphical editor

        The purpose of the view is only to hold the graphical editor. The class ob the actual editor with the OpenGL
        functionality is GraphicalEditor
        """
        GObject.GObject.__init__(self)
        View.__init__(self)

        self.v_box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        self.scroller = Gtk.ScrolledWindow()
        self.scroller.set_name('graphical_editor_scroller')
        self.editor = ExtendedGtkView(self, selection_m)
        self.editor.tool = ToolChain(self.editor). \
            append(HoverItemTool()). \
            append(MoveHandleTool()). \
            append(ConnectionCreationTool()). \
            append(ConnectionModificationTool()). \
            append(PanTool()). \
            append(ZoomTool()). \
            append(MoveItemTool()). \
            append(MultiSelectionTool()). \
            append(RightClickTool())
        self.editor.painter = painter.PainterChain(). \
            append(painter.ItemPainter()). \
            append(HoveredItemPainter()). \
            append(painter.FocusedItemPainter()). \
            append(painter.ToolPainter())
        self.scroller.add(self.editor)
        self.v_box.pack_end(self.scroller, True, True, 0)

        self['main_frame'] = self.v_box
        self.top = 'main_frame'
Пример #3
0
    def __init__(self):
        View.__init__(self)

        button_new = self['button_new']
        button_new.set_label_widget(create_label_widget_with_icon(constants.BUTTON_NEW, _("New state machine")))

        button_refresh = self['button_refresh']
        button_refresh.set_label_widget(create_label_widget_with_icon(constants.BUTTON_REFR, _("Refresh"),
                                                                      "Refresh all libraries and state machines"))

        button_refresh_selected = self['button_refresh_selected']
        button_refresh_selected.set_label_widget(create_label_widget_with_icon(constants.BUTTON_REFR,
                                                                               _("Refresh Selected"),
                                                                               "Refresh selected state machine"))

        button_open = self['button_open']
        button_open.set_label_widget(create_label_widget_with_icon(constants.BUTTON_OPEN, _("Open state machine")))

        button_save = self['button_save']
        button_save.set_label_widget(create_label_widget_with_icon(constants.BUTTON_SAVE, _("Save state machine")))

        button_refresh_libs = self['button_refresh_libs']
        button_refresh_libs.set_label_widget(
            create_label_widget_with_icon(constants.BUTTON_REFR, _("Refresh Libraries"), "Refresh all libraries"))

        button_bake_state_machine = self['button_bake_state_machine']
        button_bake_state_machine.set_label_widget(
            create_label_widget_with_icon(
                constants.BUTTON_BAKE, _("Bake State Machine"),
                "Saves the currently selected state machine and all library folders it refers to"))
Пример #4
0
    def __init__(self):
        """View holding the graphical editor

        The purpose of the view is only to hold the graphical editor. The class ob the actual editor with the OpenGL
        functionality is GraphicalEditor
        """
        View.__init__(self)

        # Configure OpenGL frame buffer.
        # Try to get a double-buffered frame buffer configuration,
        # if not successful then exit program
        display_mode = (Gtk.gdkgl.MODE_RGB | Gtk.gdkgl.MODE_DEPTH
                        | Gtk.gdkgl.MODE_DOUBLE)
        try:
            glconfig = Gtk.gdkgl.Config(mode=display_mode)
        except Gtk.gdkgl.NoMatches:
            raise SystemExit

        self.v_box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
        self.editor = GraphicalEditor(glconfig)
        self.editor.add_events(Gdk.EventMask.BUTTON_PRESS_MASK
                               | Gdk.EventMask.BUTTON_RELEASE_MASK
                               | Gdk.EventMask.BUTTON_MOTION_MASK
                               | Gdk.EventMask.KEY_PRESS_MASK
                               | Gdk.EventMask.KEY_RELEASE_MASK
                               | Gdk.EventMask.POINTER_MOTION_MASK)
        self.editor.set_size_request(0, 0)
        self.editor.set_flags(Gtk.CAN_FOCUS)

        self.v_box.pack_end(self.editor, True, True, 0)

        self['main_frame'] = self.v_box
        self.top = 'main_frame'
Пример #5
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'])
Пример #6
0
    def __init__(self):
        View.__init__(self)
        Gtk.IconView.__init__(self)
        self.props.item_orientation = Gtk.Orientation.HORIZONTAL

        self.set_columns(len(self.states))
        self.set_margin(0)
        self.set_item_width(23)
        self.set_spacing(0)
        self.set_row_spacing(0)
        self.set_column_spacing(0)

        liststore = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING)
        self.set_model(liststore)
        self.set_markup_column(0)
        self.set_tooltip_column(1)

        for shorthand, state_class, icon in self.states:
            liststore.append(['<span font_desc="{font} {size}" color="{color}">{icon}</span> {text}'.format(
                font=constants.ICON_FONT_FONTAWESOME,
                size=constants.FONT_SIZE_BIG,
                color=global_gui_config.colors['BUTTON_TEXT_COLOR'],
                icon=icon,
                text=shorthand
            ), "Add/Drag and Drop " + state_class.__name__])

        self['state_icon_view'] = self
        self.top = 'state_icon_view'
Пример #7
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'])
Пример #8
0
    def __init__(self):
        View.__init__(self)
        self.notebook = Gtk.Notebook()
        self.notebook.set_scrollable(True)
        self.notebook.set_name("state_machines_notebook")
        self.notebook.get_style_context().add_class("secondary")
        self.notebook.show()

        self['notebook'] = self.notebook
        self.top = 'notebook'
Пример #9
0
    def __init__(self):
        View.__init__(self)
        self.notebook = self['client_notebook']

        for i in range(self.notebook.get_n_pages()):
            child = self.notebook.get_nth_page(i)
            tab_label = self.notebook.get_tab_label(child)
            tab_label_text = tab_label.get_text()
            self.notebook.set_tab_label(child, create_tab_header_label(tab_label_text, self.icons))

        self.refresh_btn = self['refresh_conf_btn']
        self.refresh_btn.set_image(create_button_label(constants.BUTTON_REFR))
Пример #10
0
    def __init__(self):
        View.__init__(self)
        self.notebook = Gtk.Notebook()
        self.notebook.set_scrollable(True)
        self.notebook.set_name('states_editor_notebook')
        self.notebook.get_style_context().add_class("secondary")
        self.notebook.show()

        self.notebook.connect("button_press_event", self.button_released)

        self['notebook'] = self.notebook
        self.top = 'notebook'
Пример #11
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'])
Пример #12
0
    def __init__(self):
        View.__init__(self)
        Gtk.TreeView.__init__(self)
        self.set_name("history_tree")

        tvcolumn = Gtk.TreeViewColumn('History',
                                      Gtk.CellRendererText(),
                                      text=0)
        tvcolumn.set_property("sizing", Gtk.TreeViewColumnSizing.AUTOSIZE)
        self.append_column(tvcolumn)

        self['history_treeview'] = self
        self.top = 'history_treeview'
Пример #13
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'
Пример #14
0
    def __init__(self):
        View.__init__(self)
        Gtk.TreeView.__init__(self)
        self.set_name('library_tree')
        # self.set_grid_lines(Gtk.TREE_VIEW_GRID_LINES_HORIZONTAL)

        tvcolumn_name = Gtk.TreeViewColumn('Library Name')
        tvcolumn_name.set_property("sizing", Gtk.TreeViewColumnSizing.AUTOSIZE)
        self.append_column(tvcolumn_name)
        cell_renderer_name = Gtk.CellRendererText()
        tvcolumn_name.pack_start(cell_renderer_name, True)
        tvcolumn_name.add_attribute(cell_renderer_name, 'text', 0)

        self['library_tree_view'] = self
        self.top = 'library_tree_view'
Пример #15
0
    def __init__(self):
        View.__init__(self)

        self.inputs_view = LinkageOverviewDataView()
        self.outputs_view = LinkageOverviewDataView()
        self.scope_view = LinkageOverviewDataView()
        self.outcomes_view = LinkageOverviewLogicView()

        self['inputs_scroller'].add(self.inputs_view.get_top_widget())
        self['outputs_scroller'].add(self.outputs_view.get_top_widget())
        self['scoped_scroller'].add(self.scope_view.get_top_widget())
        self['outcomes_scroller'].add(self.outcomes_view.get_top_widget())
        self.inputs_view.scrollbar_widget = self['inputs_scroller']
        self.outputs_view.scrollbar_widget = self['outputs_scroller']
        self.scope_view.scrollbar_widget = self['scoped_scroller']
        self.outcomes_view.scrollbar_widget = self['outcomes_scroller']
Пример #16
0
    def __init__(self):
        View.__init__(self)

        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)
Пример #17
0
    def __init__(self, title):
        View.__init__(self)

        toolbar = Gtk.Toolbar()
        toolbar.props.show_arrow = False
        fullscreen_icon = label.create_button_label(constants.BUTTON_EXP)
        self['maximize_button'] = Gtk.ToolButton()
        self['maximize_button'].set_icon_widget(fullscreen_icon)
        redock_icon = label.create_button_label(constants.BUTTON_UNDOCK)
        self['redock_button'] = Gtk.ToolButton()
        self['redock_button'].set_icon_widget(redock_icon)
        self['redock_button'].set_tooltip_text("Redock")
        toolbar.insert(self['maximize_button'], 0)
        toolbar.insert(self['redock_button'], 1)

        self['headerbar'].props.title = title
        self['headerbar'].pack_end(toolbar)
        self['headerbar'].show_all()

        self.get_top_widget().set_titlebar(self['headerbar'])
Пример #18
0
    def __init__(self, top_window):
        View.__init__(self)

        self.win = top_window['main_window']
        self.insert_accelerators = {
            'new': Gtk.accelerator_parse('<control>N'),
            'open': Gtk.accelerator_parse('<control>O'),
            'save': Gtk.accelerator_parse('<control>S'),
            # 'save_as': Gtk.accelerator_parse('<shift><control>S'),  # no default accelerator insert
            'quit': Gtk.accelerator_parse('<control>Q'),
            'cut': Gtk.accelerator_parse('<control>X'),
            'copy': Gtk.accelerator_parse('<control>C'),
            'paste': Gtk.accelerator_parse('<control>V'),
            # 'delete': Gtk.accelerator_parse('Delete'),  # no default accelerator insert
            # 'undo': Gtk.accelerator_parse('<control>Z'),  # no default accelerator insert
            # 'redo': Gtk.accelerator_parse('<control>Y'),  # no default accelerator insert
        }
        self.sub_menu_open_recently = Gtk.Menu()
        self['open_recent'].set_submenu(self.sub_menu_open_recently)

        # Gtk TODO: Unfortunately does not help against not showing Accel Keys
        # self.win.add_accel_group(self['accelgroup1'])

        for menu_item_name in self.buttons:
            # set icon
            self.set_menu_item_icon(menu_item_name,
                                    self.buttons[menu_item_name])
            # set accelerator if in shortcuts dictionary with menu_item_name == key
            if menu_item_name in global_gui_config.get_config_value(
                    'SHORTCUTS'):
                shortcuts = global_gui_config.get_config_value(
                    'SHORTCUTS')[menu_item_name]
                if shortcuts:
                    main_shortcut = shortcuts[0] if isinstance(
                        shortcuts, list) else shortcuts
                    self.set_menu_item_accelerator(menu_item_name,
                                                   main_shortcut)

        for sub_menu_name in self.sub_menus:
            sub_menu = self[sub_menu_name]
            sub_menu.set_reserve_toggle_size(False)
Пример #19
0
    def __init__(self):
        View.__init__(self)

        self._lock = threading.Lock()

        self.text_view = Gtk.TextView()
        self.text_view.set_property('editable', False)

        self.filtered_buffer = self.create_text_buffer()

        self.text_view.set_buffer(self.filtered_buffer)

        self.text_view.set_border_window_size(Gtk.TextWindowType.LEFT, 10)
        self.text_view.set_border_window_size(Gtk.TextWindowType.RIGHT, 10)
        self.text_view.set_border_window_size(Gtk.TextWindowType.TOP, 10)
        self.text_view.set_border_window_size(Gtk.TextWindowType.BOTTOM, 10)

        self._enables = {}
        self._auto_scroll_handler_id = None

        scrollable = Gtk.ScrolledWindow()
        scrollable.set_policy(Gtk.PolicyType.AUTOMATIC,
                              Gtk.PolicyType.AUTOMATIC)
        scrollable.set_name('console_scroller')
        scrollable.add(self.text_view)
        self.text_view.show()

        self['scrollable'] = scrollable
        self.top = 'scrollable'
        self.quit_flag = False

        self.logging_priority = global_gui_config.get_config_value(
            "LOGGING_CONSOLE_GTK_PRIORITY", GLib.PRIORITY_LOW)

        self._stored_line_number = None
        self._stored_line_offset = None
        self._stored_text_of_line = None
        self._stored_relative_lines = None
Пример #20
0
    def __init__(self,
                 view_class,
                 width=500,
                 height=500,
                 title=None,
                 pos=None):
        View.__init__(self)

        w = Gtk.Window()
        if title is None:
            w.set_title(str(view_class))
        else:
            w.set_title(title)
        w.resize(width=width, height=height)
        if pos is not None:
            w.set_position(pos)
        self.widget_view = view_class()
        w.add(self.widget_view.get_top_widget())
        w.show_all()

        self['main_frame'] = self.widget_view
        self.top = 'main_frame'
        self['main_window'] = w
Пример #21
0
    def __init__(self):
        View.__init__(self)
        Gtk.TreeView.__init__(self)

        foreground = 5

        tvcolumn = Gtk.TreeViewColumn('Nr',
                                      Gtk.CellRendererText(),
                                      text=1,
                                      foreground=foreground)
        tvcolumn.set_property("sizing", Gtk.TreeViewColumnSizing.AUTOSIZE)
        self.append_column(tvcolumn)

        tvcolumn = Gtk.TreeViewColumn('Action',
                                      Gtk.CellRendererText(),
                                      text=2,
                                      foreground=foreground)
        tvcolumn.set_property("sizing", Gtk.TreeViewColumnSizing.AUTOSIZE)
        self.append_column(tvcolumn)

        tvcolumn = Gtk.TreeViewColumn('Parameters',
                                      Gtk.CellRendererText(),
                                      text=7,
                                      foreground=foreground)
        tvcolumn.set_property("sizing", Gtk.TreeViewColumnSizing.AUTOSIZE)
        self.append_column(tvcolumn)

        tvcolumn = Gtk.TreeViewColumn('Affects',
                                      Gtk.CellRendererText(),
                                      text=3,
                                      foreground=foreground)
        tvcolumn.set_property("sizing", Gtk.TreeViewColumnSizing.AUTOSIZE)
        # tvcolumn.set_min_width(150)
        self.append_column(tvcolumn)

        self['history_treeview'] = self
        self.top = 'history_treeview'
Пример #22
0
    def __init__(self):
        View.__init__(self)
        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
        self.top = 'history_vbox'
Пример #23
0
    def __init__(self):
        View.__init__(self)

        if os.getenv("RAFCON_START_MINIMIZED", False):
            self.get_top_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.BUTTON_COLLAPSE))
        self['collapse_tree_button'].set_tooltip_text("Collapse tree of widget")

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

        ######################################################
        # State Icons
        ######################################################
        self.state_icons = StateIconView()
        self.state_icons.show()
        self["state_icons_box"].pack_start(self.state_icons.get_top_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_top_widget())

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

        ######################################################
        # State Machine Execution History
        ######################################################
        self.execution_history = ExecutionHistoryView()
        self.execution_history.show()
        self['execution_history_alignment'].add(self.execution_history.get_top_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['graphical_editor_vbox'].pack_start(self.state_machines_editor.get_top_widget(), True, True, 0)
        self['graphical_editor_vbox'].reorder_child(self.state_machines_editor.get_top_widget(), 0)

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

        ######################################################
        # Debug Console
        ######################################################
        self.debug_console_view = DebugConsoleView()
        self['debug_console_viewport'].add(self.debug_console_view.get_top_widget())
        self.debug_console_view.get_top_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)
        self.menu_bar.show()

        self['headerbar'].pack_start(self.menu_bar.get_top_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_top_widget(), expand=False, fill=True, padding=0)
        self['top_level_vbox'].reorder_child(self.tool_bar.get_top_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_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_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))

        # --------------------------------------------------------------------------

        # Gtk TODO: find replacement for methods set_tab_hborder and set_tab_vborder
        # self['upper_notebook'].set_tab_hborder(constants.TAB_BORDER_WIDTH * 2)
        # self['upper_notebook'].set_tab_vborder(constants.TAB_BORDER_WIDTH * 3)
        # if global_gui_config.get_config_value("USE_ICONS_AS_TAB_LABELS", True):
        #     self['lower_notebook'].set_tab_hborder(int(constants.TAB_BORDER_WIDTH * 2 / 1.4))
        # else:
        #     self['lower_notebook'].set_tab_hborder(constants.TAB_BORDER_WIDTH * 2)
        # self['lower_notebook'].set_tab_vborder(constants.TAB_BORDER_WIDTH * 3)

        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)
Пример #24
0
 def __init__(self):
     View.__init__(self)
Пример #25
0
    def __init__(self):
        View.__init__(self)

        self['properties_widget'].set_border_width(constants.PADDING_LEFT)
Пример #26
0
    def __init__(self):
        View.__init__(self)

        self.page_dict = {}
        self.notebook_names = ['main_notebook_1', 'main_notebook_2']

        self.properties_view = StateOverviewView()
        self.inputs_view = InputPortsListView()
        self.outputs_view = OutputPortsListView()
        self.scopes_view = ScopedVariablesListView()
        self.outcomes_view = StateOutcomesEditorView()
        self.source_view = SourceEditorView()
        self.transitions_view = StateTransitionsEditorView()
        self.data_flows_view = StateDataFlowsEditorView()
        self.linkage_overview = LinkageOverviewView()
        self.description_view = DescriptionEditorView()
        self.semantic_data_view = SemanticDataEditorView()

        self['properties_viewport'].add(self.properties_view.get_top_widget())
        self['input_ports_scroller'].add(self.inputs_view.get_top_widget())
        self['output_ports_scroller'].add(self.outputs_view.get_top_widget())
        self['scoped_variables_scroller'].add(
            self.scopes_view.get_top_widget())
        self['outcomes_viewport'].add(self.outcomes_view.get_top_widget())
        self['source_viewport'].add(self.source_view.get_top_widget())
        self['transitions_viewport'].add(
            self.transitions_view.get_top_widget())
        self['data_flows_viewport'].add(self.data_flows_view.get_top_widget())
        self['linkage_overview_viewport'].add(
            self.linkage_overview.get_top_widget())
        self['description_viewport'].add(
            self.description_view.get_top_widget())
        self['semantic_data_viewport'].add(
            self.semantic_data_view.get_top_widget())

        self.inputs_view.scrollbar_widget = self['input_ports_scroller']
        self.outputs_view.scrollbar_widget = self['output_ports_scroller']
        self.scopes_view.scrollbar_widget = self['scoped_variables_scroller']

        self['description_text_view'] = self.description_view.textview
        self['description_scroller'] = self.description_view.scrollable

        # Gtk TODO
        # self['main_notebook_1'].set_tab_hborder(constants.TAB_BORDER_WIDTH * 2)
        # self['main_notebook_1'].set_tab_vborder(constants.TAB_BORDER_WIDTH * 3)
        # self['main_notebook_2'].set_tab_hborder(constants.TAB_BORDER_WIDTH * 2)
        # self['main_notebook_2'].set_tab_vborder(constants.TAB_BORDER_WIDTH * 3)
        # self['ports_notebook'].set_tab_hborder(constants.TAB_BORDER_WIDTH * 2)
        # self['ports_notebook'].set_tab_vborder(constants.TAB_BORDER_WIDTH * 3)

        self.page_dict["Source"] = self['main_notebook_1'].get_nth_page(0)
        self.page_dict["Logical Linkage"] = self[
            'main_notebook_1'].get_nth_page(1)
        self.page_dict["Data Linkage"] = self['main_notebook_1'].get_nth_page(
            2)
        self.page_dict["Linkage Overview"] = self[
            'main_notebook_2'].get_nth_page(0)
        self.page_dict["Description"] = self['main_notebook_2'].get_nth_page(1)
        self.page_dict["Semantic Data"] = self['main_notebook_2'].get_nth_page(
            2)
        self['main_notebook_1'].set_current_page(
            self['main_notebook_1'].page_num(self.page_dict["Source"]))
        self['main_notebook_2'].set_current_page(
            self['main_notebook_2'].page_num(self.page_dict["Description"]))

        self['add_input_port_button'].set_border_width(
            constants.BUTTON_BORDER_WIDTH)
        self['remove_input_port_button'].set_border_width(
            constants.BUTTON_BORDER_WIDTH)
        self['add_output_port_button'].set_border_width(
            constants.BUTTON_BORDER_WIDTH)
        self['remove_output_port_button'].set_border_width(
            constants.BUTTON_BORDER_WIDTH)
        self['add_scoped_variable_button'].set_border_width(
            constants.BUTTON_BORDER_WIDTH)
        self['remove_scoped_variable_button'].set_border_width(
            constants.BUTTON_BORDER_WIDTH)

        self._scoped_tab_page_number = None
        self._scoped_var_page = None
        self._scoped_var_page_tab_label = None
        self._source_tab_page_number = None
        self._source_page = None
        self._source_page_tab_label = None

        self.set_default_paned_positions()
Пример #27
0
    def __init__(self,
                 name='SOURCE EDITOR',
                 language='idl',
                 editor_style="SOURCE_EDITOR_STYLE",
                 run_with_spacer=False):
        View.__init__(self)

        self.run_with_spacer = run_with_spacer

        vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, constants.GRID_SIZE)

        # create title view port widget
        source_title = gui_helper_label.create_widget_title(name)
        source_title.show_all()

        # prepare frame for the text editor
        editor_frame = Gtk.Frame()

        # create textview/sourceview2
        self.textview = None
        self.style_scheme = None
        self.language = language
        self.editor_style = editor_style
        try:
            self.language_manager = GtkSource.LanguageManager()
            if language in self.language_manager.get_language_ids():

                self.textview = GtkSource.View.new_with_buffer(
                    self.new_buffer())
                self.textview.props.right_margin_position = 120
                self.textview.props.show_right_margin = True
                self.textview.props.highlight_current_line = True
                self.textview.props.smart_backspace = True
                self.textview.props.smart_home_end = True
                # Gtk TODO: what is this for?
                # self.textview.set_mark_category_pixbuf('INSTRUCTION',
                #                                        editor_frame.render_icon(Gtk.STOCK_GO_FORWARD,
                #                                                                 Gtk.IconSize.MENU))
                self.using_source_view = True
            else:
                logger.debug(
                    "Chosen language '{}' is not supported initiate simple TextView."
                    .format(language))
                self.textview = Gtk.TextView()
                self.using_source_view = False
        except NameError:
            self.textview = Gtk.TextView()
            self.using_source_view = False

        self.textview.props.left_margin = 5
        self.while_in_set_enabled = False
        self.register()

        # wrap text view with scroller window
        scrollable = Gtk.ScrolledWindow()
        scrollable.set_policy(Gtk.PolicyType.AUTOMATIC,
                              Gtk.PolicyType.AUTOMATIC)
        scrollable.add(self.textview)
        self.scrollable = scrollable

        # wrap scroller window with Gtk.Frame for proper viewing
        editor_frame.add(scrollable)

        # fill top widget vbox with title view port, source view and text view within
        vbox.pack_start(source_title, False, True, 0)
        self.spacer_frame = None
        if self.run_with_spacer:
            # with spacer a Gtk.Frame object is used as spacer and its is with the source view in one hbox
            hbox_frame = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0)
            self.spacer_frame = Gtk.Frame()
            hbox_frame.pack_end(self.spacer_frame,
                                expand=False,
                                fill=False,
                                padding=0)
            hbox_frame.pack_start(editor_frame,
                                  expand=True,
                                  fill=True,
                                  padding=0)
            vbox.pack_start(hbox_frame, expand=True, fill=True, padding=0)
        else:
            vbox.pack_start(editor_frame, expand=True, fill=True, padding=0)

        self['editor_frame'] = vbox
        self.top = 'editor_frame'
Пример #28
0
    def __init__(self):

        View.__init__(self)
        # Create a new window
        # self.get_window() = Gtk.Window(Gtk.WindowType.TOPLEVEL)

        # self.get_window().set_title("Execution Log Viewer")

        # self.get_window().set_default_size(1024, 786)

        # self.get_window().connect("delete_event", self.delete_event)

        # Setting up the self.grid in which the elements are to be positioned
        self.paned = Gtk.HPaned()
        # self.get_window().add(self.paned)

        # setting up the layout, putting the tree_view in a scrollwindow, and the buttons in a row
        self.scrollable_treelist = Gtk.ScrolledWindow()
        # self.scrollable_treelist.set_expand(True)
        self.paned.add1(self.scrollable_treelist)

        # setting up text view
        self.scrollable_textview = Gtk.ScrolledWindow()
        self.paned.add2(self.scrollable_textview)

        self.paned.set_position(300)

        self.text_view = Gtk.TextView(buffer=None)
        self.scrollable_textview.add(self.text_view)

        self.tree_view = Gtk.TreeView()
        self.selection = self.tree_view.get_selection()
        self.scrollable_treelist.add(self.tree_view)

        # create the TreeViewColumn to display the data
        self.tvcolumn = Gtk.TreeViewColumn('Execution History')

        # add tvcolumn to tree_view
        self.tree_view.append_column(self.tvcolumn)

        # create a CellRendererText to render the data
        self.cell = Gtk.CellRendererText()

        # add the cell to the tvcolumn and allow it to expand
        self.tvcolumn.pack_start(self.cell, True)

        # set the cell "text" attribute to column 0 - retrieve text
        # from that column in treestore
        self.tvcolumn.add_attribute(self.cell, 'text', 0)

        # make it searchable
        self.tree_view.set_search_column(0)

        # Allow sorting on the column
        self.tvcolumn.set_sort_column_id(0)

        # Allow drag and drop reordering of rows
        self.tree_view.set_reorderable(True)

        self.tree_view.show_all()
        self.paned.show_all()

        self['execution_log_paned'] = self.paned
        self['execution_log_tree_view'] = self.tree_view

        self.top = 'execution_log_tree_view'