Esempio n. 1
0
 def finish_widget_creation(self, *args, **kwds):
     WindowBase.finish_widget_creation(self)
     self.widget.SetMinSize = self.widget.SetSize
     if self.has_title:
         self.widget.SetTitle(misc.design_title(self.title))
     elif hasattr(self.widget, 'SetTitle'):
         self.widget.SetTitle(misc.design_title(self.name))
     self.widget.Bind(wx.EVT_LEFT_DOWN, self.drop_sizer)
     self.widget.Bind(wx.EVT_ENTER_WINDOW, self.on_enter)
     self.widget.Bind(wx.EVT_CLOSE, self.hide_widget)
     if wx.Platform == '__WXMSW__':
         # MSW isn't smart enough to avoid overlapping windows, so at least move it away from the 3 wxGlade frames
         self.widget.Center()
Esempio n. 2
0
 def finish_widget_creation(self, *args, **kwds):
     WindowBase.finish_widget_creation(self)
     self.widget.SetMinSize = self.widget.SetSize
     if self.has_title:
         self.widget.SetTitle(misc.design_title(self.title))
     elif hasattr(self.widget, 'SetTitle'):
         self.widget.SetTitle(misc.design_title(self.name))
     wx.EVT_LEFT_DOWN(self.widget, self.drop_sizer)
     wx.EVT_ENTER_WINDOW(self.widget, self.on_enter)
     wx.EVT_CLOSE(self.widget, self.hide_widget)
     if wx.Platform == '__WXMSW__':
         # MSW isn't smart enough to avoid overlapping windows, so at least move it away from the 3 wxGlade frames
         self.widget.Center()
     # ALB 2004-10-15
     self.widget.SetAcceleratorTable(common.palette.accel_table)
Esempio n. 3
0
 def finish_widget_creation(self, *args, **kwds):
     WindowBase.finish_widget_creation(self)
     self.widget.SetMinSize = self.widget.SetSize
     if self.has_title:
         self.widget.SetTitle(misc.design_title(self.properties["title"].get_value()))
     elif hasattr(self.widget, "SetTitle"):
         self.widget.SetTitle(misc.design_title(self.name))
     wx.EVT_LEFT_DOWN(self.widget, self.drop_sizer)
     wx.EVT_ENTER_WINDOW(self.widget, self.on_enter)
     wx.EVT_CLOSE(self.widget, self.hide_widget)
     if wx.Platform == "__WXMSW__":
         # MSW isn't smart enough to avoid overlapping windows, so
         # at least move it away from the 3 wxGlade frames
         self.widget.Center()
     # ALB 2004-10-15
     self.widget.SetAcceleratorTable(common.palette.accel_table)
Esempio n. 4
0
    def create_widget(self):
        tb_style = wx.TB_HORIZONTAL | self.style
        if wx.Platform == '__WXGTK__':
            tb_style |= wx.TB_DOCKABLE | wx.TB_FLAT
        if self.IS_TOPLEVEL:
            # "top-level" toolbar
            self.widget = wx.Frame(None, -1, misc.design_title(self.name))
            self.widget.SetClientSize((400, 30))
            self._tb = wx.ToolBar(self.widget, -1, style=tb_style)
            self.widget.SetToolBar(self._tb)
            self.widget.SetBackgroundColour(self.widget.GetBackgroundColour())
            icon = compat.wx_EmptyIcon()
            xpm = os.path.join(config.icons_path, 'toolbar.xpm')
            icon.CopyFromBitmap(misc.get_xpm_bitmap(xpm))
            self.widget.SetIcon(icon)
            self.widget.Bind(wx.EVT_CLOSE, lambda e: self.hide_widget())
            self.widget.Bind(wx.EVT_LEFT_DOWN, self.on_set_focus)
            if wx.Platform == '__WXMSW__':
                # MSW isn't smart enough to avoid overlapping windows, so
                # at least move it away from the 3 wxGlade frames
                self.widget.CenterOnScreen()
        else:
            # toolbar for a Frame
            self.widget = self._tb = wx.ToolBar(self.parent.widget, -1, style=tb_style)
            self.parent.widget.SetToolBar(self.widget)

        self.widget.Bind(wx.EVT_LEFT_DOWN, self.on_set_focus)

        # set the various property values
        self._set_bitmapsize()
        self._set_margins()
        self._set_packing()
        self._set_separation()

        self._set_tools()  # show the menus
Esempio n. 5
0
    def create_widget(self):
        if self.widget:
            # re-creating -> use old frame
            win = self.widget.GetTopLevelParent()
        else:
            style = wx.DEFAULT_FRAME_STYLE
            if common.pin_design_window: style |= wx.STAY_ON_TOP
            win = wx.Frame(common.main,
                           -1,
                           misc.design_title(self.name),
                           size=(400, 300),
                           style=style)
            import os, compat
            icon = compat.wx_EmptyIcon()
            xpm = os.path.join(config.icons_path, 'panel.xpm')
            icon.CopyFromBitmap(misc.get_xpm_bitmap(xpm))
            win.SetIcon(icon)
            win.Bind(
                wx.EVT_CLOSE,
                self.hide_widget)  # CLOSE event of the frame, not the panel
            if wx.Platform == '__WXMSW__':
                win.CentreOnScreen()

        if self.scrollable:
            self.widget = wx.ScrolledWindow(win, self.id, style=0)
        else:
            self.widget = wx.Panel(win, self.id, style=0)
        self.widget.Bind(wx.EVT_ENTER_WINDOW, self.on_enter)
        self.widget.GetBestSize = self.get_widget_best_size
Esempio n. 6
0
    def _properties_changed(self, modified, actions):
        if modified and "style" in modified:
            actions.add("recreate_parent")
            return

        if not modified or "name" in modified and self.widget is not self._tb:
            self.widget.SetTitle(misc.design_title(misc.wxstr(self.name)))

        if not modified or "margins" in modified and self._tb:
            self._set_margins()
            actions.add("refresh")
        if not modified or "bitmapsize" in modified and self._tb:
            self._set_bitmapsize()
            actions.add("refresh")
        if not modified or "packing" in modified and self._tb:
            self._set_packing()
            actions.add("refresh")
        if not modified or "separation" in modified and self._tb:
            self._set_separation()
            actions.add("refresh")
        if not modified or "tools" in modified and self._tb:
            self._set_tools()
            actions.add("refresh")

        EditStylesMixin._properties_changed(self, modified, actions)
        EditBase._properties_changed(self, modified, actions)
Esempio n. 7
0
    def properties_changed(self, modified):
        if self.has_title and (not modified or "title" in modified):
            if self.widget:
                self.widget.SetTitle(misc.design_title(self.title))
            common.app_tree.refresh(self.node)

        if not modified or "name" in modified and (self.name!=self._oldname):
            common.app_tree.app.update_top_window_name(self._oldname, self.name)

        WindowBase.properties_changed(self, modified)
Esempio n. 8
0
    def _properties_changed(self, modified, actions):
        if not modified or "scrollable" in modified:
            if self.scrollable:
                self.WX_CLASS = "wxScrolledWindow"
            else:
                self.WX_CLASS = "wxPanel"
        if not modified or "name" in modified:
            if self.widget:
                self.widget.GetParent().SetTitle(misc.design_title(self.name))

        PanelBase._properties_changed(self, modified, actions)
        TopLevelBase._properties_changed(self, modified, actions)
Esempio n. 9
0
    def properties_changed(self, modified):
        if not modified or "scrollable" in modified:
            if self.scrollable:
                # 2003-06-26 ALB: change the "class name", to allow code generation
                # for a wxScrolledWindow (see Node.write and common.class_names usage in xml_parse.py)
                self._classname = 'EditTopLevelScrolledWindow'
            else:
                self._classname = self.__class__.__name__
        if not modified or "name" in modified:
            if self.widget:
                self.widget.GetParent().SetTitle(misc.design_title(self.name))

        PanelBase.properties_changed(self, modified)
        TopLevelBase.properties_changed(self, modified)
Esempio n. 10
0
 def create_widget(self):
     win = wx.Frame(common.palette, -1, misc.design_title(self.name),
                    size=(400, 300)) 
     import os
     icon = wx.EmptyIcon()
     xpm = os.path.join(common.wxglade_path, 'icons', 'panel.xpm')
     icon.CopyFromBitmap(misc.get_xpm_bitmap(xpm))
     win.SetIcon(icon)
     #self.widget = wx.Panel(win, self.id, style=0)
     self.widget = wx.ScrolledWindow(win, self.id, style=0)
     wx.EVT_ENTER_WINDOW(self.widget, self.on_enter)
     self.widget.GetBestSize = self.get_widget_best_size
     #self.widget.SetSize = win.SetSize
     wx.EVT_CLOSE(win, self.hide_widget)
     if wx.Platform == '__WXMSW__': win.CentreOnScreen()
Esempio n. 11
0
 def create_widget(self):
     win = wx.Frame(common.palette,
                    -1,
                    misc.design_title(self.name),
                    size=(400, 300))
     import os
     icon = wx.EmptyIcon()
     xpm = os.path.join(common.wxglade_path, 'icons', 'panel.xpm')
     icon.CopyFromBitmap(misc.get_xpm_bitmap(xpm))
     win.SetIcon(icon)
     #self.widget = wx.Panel(win, self.id, style=0)
     self.widget = wx.ScrolledWindow(win, self.id, style=0)
     wx.EVT_ENTER_WINDOW(self.widget, self.on_enter)
     self.widget.GetBestSize = self.get_widget_best_size
     #self.widget.SetSize = win.SetSize
     wx.EVT_CLOSE(win, self.hide_widget)
     if wx.Platform == '__WXMSW__': win.CentreOnScreen()
Esempio n. 12
0
 def create_widget(self):
     tb_style = wx.TB_HORIZONTAL | self.style
     if wx.Platform == '__WXGTK__': tb_style |= wx.TB_DOCKABLE | wx.TB_FLAT
     if self.parent:
         self.widget = self._tb = wx.ToolBar(self.parent.widget,
                                             -1,
                                             style=tb_style)
         self.parent.widget.SetToolBar(self.widget)
     else:
         # "top-level" toolbar
         self.widget = wx.Frame(None, -1, misc.design_title(self.name))
         self.widget.SetClientSize((400, 30))
         self._tb = wx.ToolBar(self.widget, -1, style=tb_style)
         self.widget.SetToolBar(self._tb)
         self.widget.SetBackgroundColour(self._tb.GetBackgroundColour())
         import os
         icon = wx.EmptyIcon()
         xpm = os.path.join(common.wxglade_path, 'icons', 'toolbar.xpm')
         icon.CopyFromBitmap(misc.get_xpm_bitmap(xpm))
         self.widget.SetIcon(icon)
         wx.EVT_CLOSE(self.widget, lambda e: self.hide_widget())
         wx.EVT_LEFT_DOWN(self._tb, self.on_set_focus)
         if wx.Platform == '__WXMSW__':
             # MSW isn't smart enough to avoid overlapping windows, so
             # at least move it away from the 3 wxGlade frames
             self.widget.CenterOnScreen()
     wx.EVT_LEFT_DOWN(self.widget, self.on_set_focus)
     # set the various property values
     prop = self.properties
     if prop['bitmapsize'].is_active():
         self.set_bitmapsize(self.bitmapsize, refresh=False)
     if prop['margins'].is_active():
         self.set_margins(self.margins, refresh=False)
     if prop['packing'].is_active():
         self.set_packing(self.packing, refresh=False)
     if prop['separation'].is_active():
         self.set_separation(self.separation, refresh=False)
     self.set_tools(self.tools)  # show the menus
Esempio n. 13
0
    def properties_changed(self, modified):
        if not modified or "name" in modified and self.pwidget is not self.widget:
            self.pwidget.SetTitle(misc.design_title(misc.wxstr(self.name)))
        refresh = False
        if not modified or "margins" in modified and self.widget:
            self._set_margins()
            refresh = True
        if not modified or "bitmapsize" in modified and self.widget:
            self._set_bitmapsize()
            refresh = True
        if not modified or "packing" in modified and self.widget:
            self._set_packing()
            refresh = True
        if not modified or "separation" in modified and self.widget:
            self._set_separation()
            refresh = True
        if not modified or "tools" in modified and self.widget:
            self._set_tools()
            refresh = True
            
        if refresh: self._refresh_widget()

        EditBase.properties_changed(self, modified)
Esempio n. 14
0
    def create_widget(self):
        if self.IS_TOPLEVEL:
            # "top-level" menubar
            self.widget = wx.Frame(None, -1, misc.design_title(self.name))
            self.widget.SetClientSize((400, 30))
            self._mb = wx.MenuBar()
            self.widget.SetMenuBar(self._mb)
            self.widget.SetBackgroundColour(self._mb.GetBackgroundColour())
            import os
            icon = compat.wx_EmptyIcon()
            xpm = os.path.join(config.icons_path, 'menubar.png')
            icon.CopyFromBitmap(misc.get_xpm_bitmap(xpm))
            self.widget.SetIcon(icon)
            self.widget.Bind(wx.EVT_CLOSE, lambda e: self.hide_widget())
        else:
            if wx.Platform=="_WXMAC__": return   # XXX check how a toplevel menu bar behaves on Mac OS
            self.widget = self._mb = wx.MenuBar()
            if self.parent.widget: self.parent.widget.SetMenuBar(self.widget)
            if wx.Platform == '__WXMSW__' or wx.Platform == '__WXMAC__':
                self.widget.SetFocus = lambda : None

        self.widget.Bind(wx.EVT_LEFT_DOWN, self.on_set_focus)
        self.set_menus()  # show the menus
Esempio n. 15
0
 def create_widget(self):
     tb_style = wx.TB_HORIZONTAL|self.style
     if wx.Platform == '__WXGTK__': tb_style |= wx.TB_DOCKABLE|wx.TB_FLAT
     if self.parent:
         self.widget = self._tb = wx.ToolBar(
             self.parent.widget, -1, style=tb_style)
         self.parent.widget.SetToolBar(self.widget)
     else:
         # "top-level" toolbar
         self.widget = wx.Frame(None, -1, misc.design_title(self.name))
         self.widget.SetClientSize((400, 30))
         self._tb = wx.ToolBar(self.widget, -1, style=tb_style)
         self.widget.SetToolBar(self._tb)
         self.widget.SetBackgroundColour(self._tb.GetBackgroundColour())
         import os
         icon = wx.EmptyIcon()
         xpm = os.path.join(common.wxglade_path, 'icons', 'toolbar.xpm')
         icon.CopyFromBitmap(misc.get_xpm_bitmap(xpm))
         self.widget.SetIcon(icon)
         wx.EVT_CLOSE(self.widget, lambda e: self.hide_widget())
         wx.EVT_LEFT_DOWN(self._tb, self.on_set_focus)
         if wx.Platform == '__WXMSW__':
             # MSW isn't smart enough to avoid overlapping windows, so
             # at least move it away from the 3 wxGlade frames
             self.widget.CenterOnScreen()
     wx.EVT_LEFT_DOWN(self.widget, self.on_set_focus)
     # set the various property values
     prop = self.properties
     if prop['bitmapsize'].is_active():
         self.set_bitmapsize(self.bitmapsize, refresh=False)
     if prop['margins'].is_active():
         self.set_margins(self.margins, refresh=False)
     if prop['packing'].is_active():
         self.set_packing(self.packing, refresh=False)
     if prop['separation'].is_active():
         self.set_separation(self.separation, refresh=False)
     self.set_tools(self.tools) # show the menus
Esempio n. 16
0
 def create_widget(self):
     if wx.Platform == '__WXGTK__' and not EditMenuBar.__hidden_frame:
         EditMenuBar.__hidden_frame = wx.Frame(common.palette, -1, "")
         EditMenuBar.__hidden_frame.Hide()
     if self.parent:
         self.widget = self._mb = wx.MenuBar()
         if self.parent.widget: self.parent.widget.SetMenuBar(self.widget)
         if wx.Platform == '__WXMSW__' or wx.Platform == '__WXMAC__':
             self.widget.SetFocus = lambda : None
     else:
         # "top-level" menubar
         self.widget = wx.Frame(None, -1, misc.design_title(self.name))
         self.widget.SetClientSize((400, 30))
         self._mb = wx.MenuBar()
         self.widget.SetMenuBar(self._mb)
         self.widget.SetBackgroundColour(self._mb.GetBackgroundColour())
         import os
         icon = wx.EmptyIcon()
         xpm = os.path.join(common.wxglade_path, 'icons', 'menubar.xpm')
         icon.CopyFromBitmap(misc.get_xpm_bitmap(xpm))
         self.widget.SetIcon(icon)
         wx.EVT_CLOSE(self.widget, lambda e: self.hide_widget())
     wx.EVT_LEFT_DOWN(self.widget, self.on_set_focus)
     self.set_menus(self.menus) # show the menus
Esempio n. 17
0
 def create_widget(self):
     if wx.Platform == '__WXGTK__' and not EditMenuBar.__hidden_frame:
         EditMenuBar.__hidden_frame = wx.Frame(common.main, -1, "")
         EditMenuBar.__hidden_frame.Hide()
     if self.parent:
         self.widget = self._mb = wx.MenuBar()
         if self.parent.widget: self.parent.widget.SetMenuBar(self.widget)
         if wx.Platform == '__WXMSW__' or wx.Platform == '__WXMAC__':
             self.widget.SetFocus = lambda: None
     else:
         # "top-level" menubar
         self.widget = wx.Frame(None, -1, misc.design_title(self.name))
         self.widget.SetClientSize((400, 30))
         self._mb = wx.MenuBar()
         self.widget.SetMenuBar(self._mb)
         self.widget.SetBackgroundColour(self._mb.GetBackgroundColour())
         import os
         icon = compat.wx_EmptyIcon()
         xpm = os.path.join(config.icons_path, 'menubar.xpm')
         icon.CopyFromBitmap(misc.get_xpm_bitmap(xpm))
         self.widget.SetIcon(icon)
         self.widget.Bind(wx.EVT_CLOSE, lambda e: self.hide_widget())
     self.widget.Bind(wx.EVT_LEFT_DOWN, self.on_set_focus)
     self.set_menus()  # show the menus
Esempio n. 18
0
 def set_name(self, name):
     super(EditTopLevelPanel, self).set_name(name)
     if self.widget:
         self.widget.GetParent().SetTitle(misc.design_title(self.name))
Esempio n. 19
0
 def set_title(self, value):
     self.title = misc.wxstr(value)
     if self.widget:
         self.widget.SetTitle(misc.design_title(value))
Esempio n. 20
0
 def set_name(self, name):
     EditBase.set_name(self, name)
     if self.widget is not self._mb:
         self.widget.SetTitle(misc.design_title(misc.wxstr(self.name)))
Esempio n. 21
0
 def set_title(self, value):
     self.title = misc.wxstr(value)
     if self.widget:
         self.widget.SetTitle(misc.design_title(value))
Esempio n. 22
0
 def set_name(self, name):
     super(EditTopLevelPanel, self).set_name(name)
     if self.widget:
         self.widget.GetParent().SetTitle(misc.design_title(self.name))
Esempio n. 23
0
 def set_name(self, name):
     EditBase.set_name(self, name)
     if self.widget is not self._mb:
         self.widget.SetTitle(misc.design_title(misc.wxstr(self.name)))