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()
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()
def __init__(self, parent, samplingType, icon=None, map_=None): wx.Panel.__init__(self, parent=parent) self.mapWindowProperties = MapWindowProperties() self.mapWindowProperties.setValuesFromUserSettings() giface = StandaloneGrassInterface() self.samplingtype = samplingType self.parent = parent if map_: self.map_ = map_ else: self.map_ = Map() self.map_.region = self.map_.GetRegion() self._mgr = wx.aui.AuiManager(self) self.mapWindow = BufferedMapWindow(parent=self, giface=giface, Map=self.map_, properties=self.mapWindowProperties) self._mgr.AddPane(self.mapWindow, wx.aui.AuiPaneInfo().CentrePane(). Dockable(True).BestSize((-1, -1)).Name('mapwindow'). CloseButton(False).DestroyOnClose(True). Layer(0)) self._toolSwitcher = ToolSwitcher() self._toolSwitcher.toggleToolChanged.connect(self._onToolChanged) self.toolbar = RLiSetupToolbar(self, self._toolSwitcher) self.catId = 1 self._mgr.AddPane(self.toolbar, wx.aui.AuiPaneInfo(). Name("maptoolbar").Caption(_("Map Toolbar")). ToolbarPane().Left().Name('mapToolbar'). CloseButton(False).Layer(1).Gripper(False). BestSize((self.toolbar.GetBestSize()))) self._mgr.Update() if self.samplingtype == SamplingType.REGIONS: self.afterRegionDrawn = Signal('RLiSetupMapPanel.afterRegionDrawn') self._registeredGraphics = self.mapWindow.RegisterGraphicsToDraw( graphicsType='line') elif self.samplingtype in [SamplingType.MUNITSR, SamplingType.MMVWINR]: self.sampleFrameChanged = Signal( 'RLiSetupMapPanel.sampleFrameChanged') self._registeredGraphics = self.mapWindow.RegisterGraphicsToDraw( graphicsType='rectangle') elif self.samplingtype in [SamplingType.MUNITSC, SamplingType.MMVWINC]: self.afterCircleDrawn = Signal('RLiSetupMapPanel.afterCircleDrawn') self._registeredGraphics = self.mapWindow.RegisterGraphicsToDraw( graphicsType='line') else: self.sampleFrameChanged = Signal( 'RLiSetupMapPanel.sampleFrameChanged') self._registeredGraphics = self.mapWindow.RegisterGraphicsToDraw( graphicsType='rectangle') self._registeredGraphics.AddPen('rlisetup', wx.Pen(wx.GREEN, width=2, style=wx.SOLID)) self._registeredGraphics.AddItem(coords=[[0, 0], [0, 0]], penName='rlisetup', hide=True) if self.samplingtype != SamplingType.VECT: self.toolbar.SelectDefault()
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))