Ejemplo n.º 1
0
    def __init__(
        self,
        parent=None,
        id=wx.ID_ANY,
        title="",
        auimgr=None,
        name="",
        **kwargs,
    ):
        """

        .. warning::
            Use \a auimgr parameter only if you know what you are doing.

        :param parent: gui parent
        :param id: wx id
        :param title: window title
        :param toolbars: array of activated toolbars, e.g. ['map', 'digit']
        :param auimgr: AUI manager (if \c None, wx.aui.AuiManager is used)
        :param name: panel name
        :param kwargs: arguments passed to \c wx.Panel
        """

        self.parent = parent

        wx.Panel.__init__(self, parent, id, name=name, **kwargs)

        # toolbars
        self.toolbars = {}
        self.iconsize = (16, 16)

        # properties are shared in other objects, so defining here
        self.mapWindowProperties = MapWindowProperties()
        self.mapWindowProperties.setValuesFromUserSettings()
        # update statusbar when user-defined projection changed
        self.mapWindowProperties.useDefinedProjectionChanged.connect(
            self.StatusbarUpdate)

        #
        # Fancy gui
        #
        if auimgr is None:
            from wx.aui import AuiManager

            self._mgr = AuiManager(self)
        else:
            self._mgr = auimgr

        # handles switching between tools in different toolbars
        self._toolSwitcher = ToolSwitcher()
        self._toolSwitcher.toggleToolChanged.connect(self._onToggleTool)

        # set accelerator table
        self.shortcuts_table = [
            (self.OnCloseWindow, wx.ACCEL_CTRL, ord("W")),
            (self.OnRender, wx.ACCEL_CTRL, ord("R")),
            (self.OnRender, wx.ACCEL_NORMAL, wx.WXK_F5),
        ]

        self._initShortcuts()
Ejemplo n.º 2
0
 def __init__(self, *args, **kwargs):
     self.app = kwargs.pop('app', None)
     wx.Frame.__init__(self, *args, **kwargs)
     # =============== Logging Text Control ================
     self.log_ctrl = log_ctrl(self,
                              style=wx.TE_MULTILINE,
                              add_to_file=True)
     sys.stdout = self.log_ctrl
     sys.stderr = self.log_ctrl
     self.log = wx.LogTextCtrl(self.log_ctrl)
     self.log.SetLogLevel(wx.LOG_Error)
     wx.Log_SetActiveTarget(self.log)
     # =============== player Control ================
     self.player = player_ctrl(self)
     # =============== StatusBar ================
     statusbar = self.CreateStatusBar(2)
     statusbar.SetStatusWidths([-1, -1])
     statusbar.SetStatusText(_('Welcome into application!'), 0)
     # =============== AuiManager ================
     self.aui_manager = AuiManager()
     self.aui_manager.SetManagedWindow(self)
     self.aui_manager.AddPane(self.player,
                              AuiPaneInfo().Name('player').CenterPane())
     self.aui_manager.AddPane(
         self.log_ctrl,
         AuiPaneInfo().Name('log_ctrl').Bottom().Layer(0).BestSize(
             (100, 100)).Hide())
     if self.log_ctrl.GetValue() != '':
         self.aui_manager.GetPane('log_ctrl').Show()
     self.aui_manager.Update()
Ejemplo n.º 3
0
    def __init__(self,
                 parent=None,
                 id=wx.ID_ANY,
                 title='',
                 style=wx.DEFAULT_FRAME_STYLE,
                 auimgr=None,
                 name='',
                 **kwargs):
        """

        .. warning::
            Use \a auimgr parameter only if you know what you are doing.

        :param parent: gui parent
        :param id: wx id
        :param title: window title
        :param style: \c wx.Frame style
        :param toolbars: array of activated toolbars, e.g. ['map', 'digit']
        :param auimgr: AUI manager (if \c None, wx.aui.AuiManager is used)
        :param name: frame name
        :param kwargs: arguments passed to \c wx.Frame
        """

        self.parent = parent

        wx.Frame.__init__(self,
                          parent,
                          id,
                          title,
                          style=style,
                          name=name,
                          **kwargs)

        #
        # set the size & system icon
        #
        self.SetClientSize(self.GetSize())
        self.iconsize = (16, 16)

        self.SetIcon(
            wx.Icon(os.path.join(globalvar.ICONDIR, 'grass_map.ico'),
                    wx.BITMAP_TYPE_ICO))

        # toolbars
        self.toolbars = {}

        #
        # Fancy gui
        #
        if auimgr is None:
            from wx.aui import AuiManager
            self._mgr = AuiManager(self)
        else:
            self._mgr = auimgr

        # handles switching between tools in different toolbars
        self._toolSwitcher = ToolSwitcher()
        self._toolSwitcher.toggleToolChanged.connect(self._onToggleTool)

        self._initShortcuts()
Ejemplo n.º 4
0
    def __init__(self,
                 parent=None,
                 id=wx.ID_ANY,
                 title='',
                 style=wx.DEFAULT_FRAME_STYLE,
                 auimgr=None,
                 name='',
                 **kwargs):
        """

        .. warning::
            Use \a auimgr parameter only if you know what you are doing.

        :param parent: gui parent
        :param id: wx id
        :param title: window title
        :param style: \c wx.Frame style
        :param toolbars: array of activated toolbars, e.g. ['map', 'digit']
        :param auimgr: AUI manager (if \c None, wx.aui.AuiManager is used)
        :param name: frame name
        :param kwargs: arguments passed to \c wx.Frame
        """

        self.parent = parent

        wx.Frame.__init__(self,
                          parent,
                          id,
                          title,
                          style=style,
                          name=name,
                          **kwargs)

        #
        # set the size & system icon
        #
        self.SetClientSize(self.GetSize())
        self.iconsize = (16, 16)

        self.SetIcon(
            wx.Icon(os.path.join(globalvar.ICONDIR, 'grass_map.ico'),
                    wx.BITMAP_TYPE_ICO))

        # toolbars
        self.toolbars = {}

        #
        # Fancy gui
        #
        if auimgr is None:
            from wx.aui import AuiManager
            self._mgr = AuiManager(self)
        else:
            self._mgr = auimgr

        # handles switching between tools in different toolbars
        self._toolSwitcher = ToolSwitcher()
        self._toolSwitcher.toggleToolChanged.connect(self._onToggleTool)

        # set accelerator table (fullscreen, close window)
        accelTable = []
        for wxId, handler, entry, kdb in ((wx.NewId(), self.OnFullScreen,
                                           wx.ACCEL_NORMAL, wx.WXK_F11),
                                          (wx.NewId(), self.OnCloseWindow,
                                           wx.ACCEL_CTRL, ord('W'))):
            self.Bind(wx.EVT_MENU, handler, id=wxId)
            accelTable.append((entry, kdb, wxId))

        self.SetAcceleratorTable(wx.AcceleratorTable(accelTable))