root/gaphor/tags/gaphor-0.12.0/gaphor/ui/consolewindow.py

Revision 1279, 1.5 kB (checked in by arj..@yirdis.nl, 2 years ago)

added about screen

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 #!/usr/bin/env python
2 # vim: sw=4:et
3
4 import sys
5 import gtk
6 from zope import interface
7 import gaphor
8 from gaphor.interfaces import IActionProvider
9 from gaphor.ui.interfaces import IUIComponent
10 from gaphor.action import action, build_action_group
11 from gaphor.misc.console import GTKInterpreterConsole
12 from toplevelwindow import ToplevelWindow
13
14
15 class ConsoleWindow(ToplevelWindow):
16    
17     interface.implements(IActionProvider)
18
19     menu_xml = """
20         <ui>
21           <menubar name="mainwindow">
22             <menu action="tools">
23               <menuitem action="ConsoleWindow:open" />
24             </menu>
25           </menubar>
26           <menubar name="consolewindow">
27             <menu action="file">
28               <menuitem action="ConsoleWindow:close" />
29             </menu>
30           </menubar>
31         </ui>
32         """
33
34     title = 'Gaphor Console'
35     size = (400, 400)
36     menubar_path = '/consolewindow'
37     toolbar_path = ''
38
39     def __init__(self):
40         self.action_group = build_action_group(self)
41         self.window = None
42         self.ui_manager = None # injected
43
44     def ui_component(self):
45         console = GTKInterpreterConsole()
46         console.show()
47         return console
48
49     @action(name='ConsoleWindow:open', label='_Console')
50     def open(self):
51         if not self.window:
52             self.construct()
53         else:
54             self.window.show_all()
55
56     @action(name='ConsoleWindow:close', stock_id='gtk-close', accel='<Control><Shift>w')
57     def close(self):
58         self.window.destroy()
59         self.window = None
60
Note: See TracBrowser for help on using the browser.