|
Revision 1289, 1.3 kB
(checked in by arj..@yirdis.nl, 2 years ago)
|
Added the rest of the tools. fixed toolbox display.
|
| Line | |
|---|
| 1 |
""" |
|---|
| 2 |
Basic stuff for toplevel windows. |
|---|
| 3 |
""" |
|---|
| 4 |
|
|---|
| 5 |
import gtk |
|---|
| 6 |
|
|---|
| 7 |
from zope import interface |
|---|
| 8 |
from interfaces import IUIComponent |
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
class ToplevelWindow(object): |
|---|
| 12 |
|
|---|
| 13 |
interface.implements(IUIComponent) |
|---|
| 14 |
|
|---|
| 15 |
menubar_path = '' |
|---|
| 16 |
toolbar_path = '' |
|---|
| 17 |
|
|---|
| 18 |
def __init__(self): |
|---|
| 19 |
self.window = None |
|---|
| 20 |
|
|---|
| 21 |
def construct(self): |
|---|
| 22 |
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) |
|---|
| 23 |
self.window.set_title(self.title) |
|---|
| 24 |
self.window.set_size_request(*self.size) |
|---|
| 25 |
self.window.set_resizable(True) |
|---|
| 26 |
|
|---|
| 27 |
self.window.add_accel_group(self.ui_manager.get_accel_group()) |
|---|
| 28 |
|
|---|
| 29 |
vbox = gtk.VBox() |
|---|
| 30 |
self.window.add(vbox) |
|---|
| 31 |
vbox.show() |
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
menubar = self.ui_manager.get_widget(self.menubar_path) |
|---|
| 37 |
if menubar: |
|---|
| 38 |
vbox.pack_start(menubar, expand=False) |
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 |
if self.toolbar_path: |
|---|
| 42 |
toolbar = self.ui_manager.get_widget(self.toolbar_path) |
|---|
| 43 |
if toolbar: |
|---|
| 44 |
vbox.pack_start(toolbar, expand=False) |
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
vbox.pack_end(self.ui_component(), expand=True) |
|---|
| 48 |
vbox.show() |
|---|
| 49 |
|
|---|
| 50 |
self.window.show() |
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 |
|
|---|