Ejemplo n.º 1
0
 def __init__(self, *args):
     Editor.__init__(self, *args)
     self._create_signal_page()
Ejemplo n.º 2
0
    def _application_window_create(self):
        application_window = gtk.VBox()
        # layout them on the window
        main_vbox = gtk.VBox()
        application_window.add(main_vbox)
        # Create actions that are always enabled
        main_vbox.show()

        # Create actions that are always enabled
        bar_manager.add_actions(
            'Normal',
            # File menu
            ('FileMenu', None, _('_File')),
            ('New', gtk.STOCK_NEW, None, None, _('New Project'), self._new_cb),
            ('Open', gtk.STOCK_OPEN, None, None, _('Open Project'),
             self._open_cb),
            ('Quit', gtk.STOCK_QUIT, None, None, _('Quit'), self._quit_cb),

            # Edit menu
            ('EditMenu', None, _('_Edit')),

            # Object menu
            ('ObjectMenu', None, _('_Objects')),

            # Project menu
            ('ProjectMenu', None, _('_Project')),
            # (projects..)

            # Debug menu
            ('DebugMenu', None, _('_Debug')),
            ('DumpData', None, _('Dump data'), '<control>M',
             _('Dump debug data'), self._dump_data_cb),
            ('Reload', None, _('Reload'), None, _('Reload python code'),
             self._reload_cb),
            ('Preview', None, _('Preview'), None, _('Preview current window'),
             self._preview_cb),

            # Help menu
            ('HelpMenu', None, _('_Help')),
            ('About', gtk.STOCK_ABOUT, None, None, _('About Gazpacho'),
             self._about_cb),
        )

        # Toggle actions
        bar_manager.add_toggle_actions(
            'Normal',
            ('ShowStructure', None, _('Show _structure'), '<control><shift>t',
             _('Show container structure'), self._show_structure_cb, False),
            ('ShowCommandStack', None, _('Show _command stack'), 'F3',
             _('Show the command stack'), self._show_command_stack_cb, False),
            ('ShowClipboard', None, _('Show _clipboard'), 'F4',
             _('Show the clipboard'), self._show_clipboard_cb, False),
            ('ShowWorkspace', None, _('Show _workspace'), '<control><shift>t',
             _('Show container workspace'), self._show_workspace_cb, False),
        )

        # Create actions that reqiuire a project to be enabled
        bar_manager.add_actions(
            'ContextActions',
            # File menu
            ('Save', gtk.STOCK_SAVE, None, None, _('Save Project'),
             self._save_cb),
            ('SaveAs', gtk.STOCK_SAVE_AS,
             _('Save _As...'), '<shift><control>S',
             _('Save project with different name'), self._save_as_cb),
            ('Close', gtk.STOCK_CLOSE, None, None, _('Close Project'),
             self._close_cb),
            # Edit menu
            ('Undo', gtk.STOCK_UNDO, None, '<control>Z', _('Undo last action'),
             self._undo_cb),
            ('Redo', gtk.STOCK_REDO, None, '<shift><control>Z',
             _('Redo last action'), self._redo_cb))

        bar_manager.add_actions(
            'AlwaysDisabled',
            # Edit menu
            ('Cut', gtk.STOCK_CUT, None, None, _('Cut'), None),
            ('Copy', gtk.STOCK_COPY, None, None, _('Copy'), None),
            ('Paste', gtk.STOCK_PASTE, None, None, _('Paste'), None),
            ('Delete', gtk.STOCK_DELETE, None, '<control>D', _('Delete'),
             None))

        bar_manager.build_interfaces()
        self._update_recent_project_items()
        #application_window.add_accel_group(bar_manager.get_accel_group())
        #main_vbox.pack_start(bar_manager.get_menubar(), False)
        #main_vbox.pack_start(bar_manager.get_toolbar(), False)

        hbox = gtk.HBox(spacing=6)
        main_vbox.pack_start(hbox)
        hbox.show()

        palette.connect('toggled', self._on_palette_toggled)
        pal_parent = palette.get_parent()
        if pal_parent is not None:
            pal_parent.remove(palette)
        hbox.pack_end(palette, False, False)
        palette.show_all()

        sw = gtk.ScrolledWindow()
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        sw.set_size_request(400, -1)
        hbox.pack_start(sw, True, True)

        self._workspace = WorkSpace()
        sw.add_with_viewport(self._workspace)
        self._workspace.show()
        sw.set_no_show_all(True)
        self._workspace_sw = sw
        self._workspace_action = bar_manager.get_action(
            'ui/MainMenu/EditMenu/ShowWorkspace')
        self._workspace_action.set_active(False)

        vpaned = gtk.VPaned()
        vpaned.set_position(150)
        hbox.pack_start(vpaned, True, True)
        vpaned.show()

        notebook = gtk.Notebook()
        vpaned.add1(notebook)
        notebook.show()

        # Widget view
        widget_view = WidgetTreeView(self)
        self._add_view(widget_view)
        page_num = notebook.append_page(widget_view, gtk.Label(_('Widgets')))
        widget_view.show()

        state = WidgetUIMState()
        self._uim_states[page_num] = state

        # Action view
        self.gactions_view = GActionsView(self)
        self._add_view(self.gactions_view)
        page_num = notebook.append_page(self.gactions_view,
                                        gtk.Label(_('Actions')))
        self.gactions_view.show()

        state = ActionUIMState(self.gactions_view)
        self._uim_states[page_num] = state

        # Sizegroup view
        self.sizegroup_view = SizeGroupView(self)
        self._add_view(self.sizegroup_view)
        page_num = notebook.append_page(self.sizegroup_view,
                                        gtk.Label(_('Size Groups')))
        self.sizegroup_view.show()

        state = SizeGroupUIMState(self.sizegroup_view)
        self._uim_states[page_num] = state

        # Add property editor
        self._editor = Editor(self)
        vpaned.add2(self._editor)
        self._editor.show_all()

        notebook.connect('switch-page', self._on_notebook_switch_page)

        # Statusbar
        statusbar = gtk.Statusbar()
        self._statusbar_menu_context_id = statusbar.get_context_id("menu")
        self._statusbar_actions_context_id = statusbar.get_context_id(
            "actions")
        #main_vbox.pack_end(statusbar, False)
        self._statusbar = statusbar
        #statusbar.show()

        # dnd doesn't seem to work with Konqueror, at least not when
        # gtk.DEST_DEFAULT_ALL or gtk.DEST_DEFAULT_MOTION is used. If
        # handling the drag-motion event it will work though, but it's
        # a bit tricky.
        #application_window.drag_dest_set(gtk.DEST_DEFAULT_ALL,
        #                                 Application.targets,
        #                                 gtk.gdk.ACTION_COPY)

        #application_window.connect('drag-data-received',
        #                           self._dnd_data_received_cb)

        # Enable the current state
        self._active_uim_state = self._uim_states[0]
        self._active_uim_state.enable()

        return application_window
Ejemplo n.º 3
0
    def _application_window_create(self):
        application_window = gtk.VBox()
        # layout them on the window
        main_vbox = gtk.VBox()
        application_window.add(main_vbox)
        # Create actions that are always enabled
        main_vbox.show()

        # Create actions that are always enabled
        bar_manager.add_actions(
            'Normal',
            # File menu
            ('FileMenu', None, _('_File')),
            ('New', gtk.STOCK_NEW, None, None,
             _('New Project'), self._new_cb),
            ('Open', gtk.STOCK_OPEN, None, None,
             _('Open Project'), self._open_cb),
            ('Quit', gtk.STOCK_QUIT, None, None,
             _('Quit'), self._quit_cb),

            # Edit menu
            ('EditMenu', None, _('_Edit')),

            # Object menu
            ('ObjectMenu', None, _('_Objects')),

            # Project menu
            ('ProjectMenu', None, _('_Project')),
            ('ProjectProperties', None, _('_Properties'), None,
             _('Project properties'), self._project_properties_cb),

            # (projects..)

            # Debug menu
            ('DebugMenu', None, _('_Debug')),
            ('DumpData', None, _('Dump data'), '<control>M',
              _('Dump debug data'), self._dump_data_cb),
            ('Reload', None, _('Reload'), None,
             _('Reload python code'), self._reload_cb),
            ('Preview', None, _('Preview'), None,
             _('Preview current window'), self._preview_cb),

            # Help menu
            ('HelpMenu', None, _('_Help')),
            ('About', gtk.STOCK_ABOUT, None, None, _('About Gazpacho'),
             self._about_cb),
            )

        # Toggle actions
        bar_manager.add_toggle_actions(
            'Normal',
            ('ShowStructure', None, _('Show _structure'), '<control><shift>t',
             _('Show container structure'), self._show_structure_cb, False),
            ('ShowCommandStack', None, _('Show _command stack'), 'F3',
             _('Show the command stack'), self._show_command_stack_cb, False),
            ('ShowClipboard', None, _('Show _clipboard'), 'F4',
             _('Show the clipboard'), self._show_clipboard_cb, False),
            ('ShowWorkspace', None, _('Show _workspace'), '<control><shift>t',
             _('Show container workspace'), self._show_workspace_cb, False),
            )

        # Create actions that reqiuire a project to be enabled
        bar_manager.add_actions(
            'ContextActions',
            # File menu
            ('Save', gtk.STOCK_SAVE, None, None,
             _('Save Project'), self._save_cb),
            ('SaveAs', gtk.STOCK_SAVE_AS, _('Save _As...'), '<shift><control>S',
             _('Save project with different name'), self._save_as_cb),
            ('Close', gtk.STOCK_CLOSE, None, None,
             _('Close Project'), self._close_cb),
            # Edit menu
            ('Undo', gtk.STOCK_UNDO, None, '<control>Z',
             _('Undo last action'), self._undo_cb),
            ('Redo', gtk.STOCK_REDO, None, '<shift><control>Z',
             _('Redo last action'), self._redo_cb)
            )

        bar_manager.add_actions(
            'AlwaysDisabled',
            # Edit menu
            ('Cut', gtk.STOCK_CUT, None, None,
             _('Cut'), None),
            ('Copy', gtk.STOCK_COPY, None, None,
             _('Copy'), None),
            ('Paste', gtk.STOCK_PASTE, None, None,
             _('Paste'), None),
            ('Delete', gtk.STOCK_DELETE, None, '<control>D',
             _('Delete'), None)
            )

        bar_manager.build_interfaces()
        self._update_recent_project_items()
        #application_window.add_accel_group(bar_manager.get_accel_group())
        #main_vbox.pack_start(bar_manager.get_menubar(), False)
        #main_vbox.pack_start(bar_manager.get_toolbar(), False)

        hbox = gtk.HBox(spacing=6)
        main_vbox.pack_start(hbox)
        hbox.show()

        palette.connect('toggled', self._on_palette_toggled)
        pal_parent = palette.get_parent()
        if pal_parent is not None:
            pal_parent.remove(palette)
        hbox.pack_end(palette, False, False)
        palette.show_all()

        sw = gtk.ScrolledWindow()
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        sw.set_size_request(400, -1)
        hbox.pack_start(sw, True, True)

        self._workspace = WorkSpace()
        sw.add_with_viewport(self._workspace)
        self._workspace.show()
        sw.set_no_show_all(True)
        self._workspace_sw = sw
        self._workspace_action = bar_manager.get_action(
            'ui/MainMenu/EditMenu/ShowWorkspace')
        self._workspace_action.set_active(False)

        vpaned = gtk.VPaned()
        vpaned.set_position(150)
        hbox.pack_start(vpaned, True, True)
        vpaned.show()

        notebook = gtk.Notebook()
        vpaned.add1(notebook)
        notebook.show()

        # Widget view
        widget_view = WidgetTreeView(self)
        self._add_view(widget_view)
        page_num = notebook.append_page(widget_view, gtk.Label(_('Widgets')))
        widget_view.show()

        state = WidgetUIMState()
        self._uim_states[page_num] = state

        # Action view
        self.gactions_view = GActionsView(self)
        self._add_view(self.gactions_view)
        page_num = notebook.append_page(self.gactions_view,
                                        gtk.Label(_('Actions')))
        self.gactions_view.show()

        state = ActionUIMState(self.gactions_view)
        self._uim_states[page_num] = state

        # Sizegroup view
        self.sizegroup_view = SizeGroupView(self)
        self._add_view(self.sizegroup_view)
        page_num = notebook.append_page(self.sizegroup_view,
                                        gtk.Label(_('Size Groups')))
        self.sizegroup_view.show()

        state = SizeGroupUIMState(self.sizegroup_view)
        self._uim_states[page_num] = state

        # Add property editor
        self._editor = Editor(self)
        vpaned.add2(self._editor)
        self._editor.show_all()

        notebook.connect('switch-page', self._on_notebook_switch_page)

        # Statusbar
        statusbar = gtk.Statusbar()
        self._statusbar_menu_context_id = statusbar.get_context_id("menu")
        self._statusbar_actions_context_id = statusbar.get_context_id("actions")
        #main_vbox.pack_end(statusbar, False)
        self._statusbar = statusbar
        #statusbar.show()

        # dnd doesn't seem to work with Konqueror, at least not when
        # gtk.DEST_DEFAULT_ALL or gtk.DEST_DEFAULT_MOTION is used. If
        # handling the drag-motion event it will work though, but it's
        # a bit tricky.
        #application_window.drag_dest_set(gtk.DEST_DEFAULT_ALL,
        #                                 Application.targets,
        #                                 gtk.gdk.ACTION_COPY)

        #application_window.connect('drag-data-received',
        #                           self._dnd_data_received_cb)

        # Enable the current state
        self._active_uim_state = self._uim_states[0]
        self._active_uim_state.enable()
        

        return application_window
Ejemplo n.º 4
0
    def _application_window_create(self):
        application_window = gtk.VBox()
        # Layout them on the window
        main_vbox = gtk.VBox()
        application_window.add(main_vbox)
        # Create actions that are always enabled

        hbox = gtk.HBox(spacing=6)
        main_vbox.pack_start(hbox)

        pal = palette.Palette()
        pal.connect('toggled', self._palette_button_clicked)
        pal_parent = pal.get_parent()
        if pal_parent is not None:
            pal_parent.remove(pal)
        hbox.pack_start(pal, False, False)

        vpaned = gtk.VPaned()
        vpaned.set_position(150)
        hbox.pack_start(vpaned, True, True)

        notebook = gtk.Notebook()
        vpaned.add1(notebook)

        # Widget view
        widget_view = WidgetTreeView(self)
        self._add_view(widget_view)
        page_num = notebook.append_page(widget_view, gtk.Label(_('Widgets')))

        state = WidgetUIMState()
        self._uim_states[page_num] = state

        # Action view
        self.gactions_view = GActionsView(self)
        self._add_view(self.gactions_view)
        page_num = notebook.append_page(self.gactions_view,
                                        gtk.Label(_('Actions')))

        state = ActionUIMState(self.gactions_view)
        self._uim_states[page_num] = state

        # Sizegroup view
        self.sizegroup_view = SizeGroupView(self)
        self._add_view(self.sizegroup_view)
        page_num = notebook.append_page(self.sizegroup_view,
                                        gtk.Label(_('Size Groups')))

        state = SizeGroupUIMState(self.sizegroup_view)
        self._uim_states[page_num] = state

        # Add property editor
        self._editor = Editor(self)
        self._editor.row_activated_cb = self.cb_signal_activated
        vpaned.add2(self._editor)

        notebook.connect('switch-page', self._switch_page_cb)

        # Statusbar
        statusbar = gtk.Statusbar()
        self._statusbar_menu_context_id = statusbar.get_context_id("menu")
        self._statusbar_actions_context_id = statusbar.get_context_id(
            "actions")
        main_vbox.pack_end(statusbar, False)
        self._statusbar = statusbar

        # dnd doesn't seem to work with Konqueror, at least not when
        # gtk.DEST_DEFAULT_ALL or gtk.DEST_DEFAULT_MOTION is used. If
        # handling the drag-motion event it will work though, but it's
        # a bit tricky.
        #application_window.drag_dest_set(gtk.DEST_DEFAULT_ALL,
        #                                 Application.targets,
        #                                 gtk.gdk.ACTION_COPY)

        #application_window.connect('drag_data_received',
        #                           self._dnd_data_received_cb)

        # Enable the current state
        self._active_uim_state = self._uim_states[0]
        #self._active_uim_state.enable()

        return application_window