def __init__(self, parent, cache): ''' Initialises the View Logs dialog. Arguments parent: The parent window for the dialog. cache: The cache object to display the logs from. ''' wx.Dialog.__init__(self, parent, wx.ID_ANY, _("Logs for ") + cache.code, size=(650, 500), style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE) # Create a scrolled panel and a vertical sizer within it to take the logs sw = Scrolled.ScrolledPanel(self, -1, size=(640, 450), style=wx.TAB_TRAVERSAL) logSizer = wx.BoxSizer(orient=wx.VERTICAL) res = Xrc.XmlResource( os.path.join(geocacher.getBasePath(), 'xrc', 'logPanel.xrc')) # Create a block for each log and add it to the logs sizer for log in cache.getLogs(): logPanel = res.LoadPanel(sw, 'logPanel') date = Xrc.XRCCTRL(logPanel, 'dateText') logType = Xrc.XRCCTRL(logPanel, 'typeText') finder = Xrc.XRCCTRL(logPanel, 'finderText') message = Xrc.XRCCTRL(logPanel, 'messageText') date.SetValue(log.date.strftime("%x")) logType.SetValue(log.logType) finder.SetValue(log.finder_name) message.SetValue(log.text) logSizer.Add(logPanel) # Final Setup of the scrolled panel sw.SetSizer(logSizer) sw.SetAutoLayout(1) sw.SetupScrolling() # Buttons closeButton = wx.Button(self, wx.ID_CLOSE) self.Bind(wx.EVT_BUTTON, self.OnClose, closeButton) buttonBox = wx.BoxSizer(orient=wx.HORIZONTAL) buttonBox.Add(closeButton, 0, wx.EXPAND) # finally, put the scrolledPannel and buttons in a sizer to manage the layout mainSizer = wx.BoxSizer(orient=wx.VERTICAL) mainSizer.Add(sw) mainSizer.Add(buttonBox, 0, wx.EXPAND) self.SetSizer(mainSizer)
def __init__(self, parent, cache, markType, date=None, logText='', encoded=False): ''' Initialises the View Travel Bugs Frame Arguments parent: The parent window for the dialog. cache: The cache object to display the travel bugs from. ''' pre = wx.PreDialog() self.res = Xrc.XmlResource( os.path.join(geocacher.getBasePath(), 'xrc', 'foundCache.xrc')) self.res.LoadOnDialog(pre, parent, 'FoundCacheDialog') self.PostCreate(pre) self.SetTitle(_('Mark cache ') + cache + _(' as ') + markType) self.date = Xrc.XRCCTRL(self, 'datePick') self.logText = Xrc.XRCCTRL(self, 'logText') self.encodeLog = Xrc.XRCCTRL(self, 'encodeLogCb') if date != None: self.date.SetValue( wx.DateTimeFromDMY(date.day, date.month - 1, date.year)) if logText == None: logText = '' self.logText.SetValue(logText) self.encodeLog.SetValue(encoded)
def __init__(self, parent, cache, markType, date=None, logText="", encoded=False): """ Initialises the View Travel Bugs Frame Arguments parent: The parent window for the dialog. cache: The cache object to display the travel bugs from. """ pre = wx.PreDialog() self.res = Xrc.XmlResource(os.path.join(geocacher.getBasePath(), "xrc", "foundCache.xrc")) self.res.LoadOnDialog(pre, parent, "FoundCacheDialog") self.PostCreate(pre) self.SetTitle(_("Mark cache ") + cache + _(" as ") + markType) self.date = Xrc.XRCCTRL(self, "datePick") self.logText = Xrc.XRCCTRL(self, "logText") self.encodeLog = Xrc.XRCCTRL(self, "encodeLogCb") if date != None: self.date.SetValue(wx.DateTimeFromDMY(date.day, date.month - 1, date.year)) if logText == None: logText = "" self.logText.SetValue(logText) self.encodeLog.SetValue(encoded)
def __init__(self, table): Grid.PyGridCellRenderer.__init__(self) self._dir = os.path.join(geocacher.getBasePath(),'gfx') self._themeDir = geocacher.config().iconTheme self.table = table self._images = {} self._default = None self.colSize = None self.rowSize = None
def __init__(self, parent, id): ''' Initialisation for the main frame. Arguments parent: The parent window of the frame. id: The ID to give the frame. ''' self.displayCache = None size = geocacher.config().mainWinSize # check that the Current location is in the db if geocacher.config().currentLocation not in geocacher.db( ).getLocationNameList(): geocacher.config().currentLocation = geocacher.db( ).getLocationNameList()[0] wx.Frame.__init__(self, parent, wx.ID_ANY, _("Geocacher"), size=(size), style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE) self.Bind(wx.EVT_CLOSE, self.OnQuit) self.SetIcon( wx.Icon( os.path.join(geocacher.getBasePath(), 'gfx', 'treasure_chest.ico'), wx.BITMAP_TYPE_ICO)) self.buildStatusBar() self.buildMenu() self.buildToolBar() self.splitter = wx.SplitterWindow(self, wx.ID_ANY, style=wx.SP_LIVE_UPDATE | wx.SP_BORDER) self.cacheGrid = CacheGrid(self.splitter) self.Description = Html.HtmlWindow(self.splitter, wx.ID_ANY, name="Description Pannel") self.splitter.SetMinimumPaneSize(20) self.splitter.SplitHorizontally(self.cacheGrid, self.Description, geocacher.config().detailSplit) self.updateStatus() self.displayedCache = None self.updateDetail(geocacher.config().displayedCache) Publisher.subscribe(self.updateDetailMsg, 'cache.selected') Publisher.subscribe(self.NewLocationMsg, 'location.new') Publisher.subscribe(self.popStatusMsg, 'status.pop') Publisher.subscribe(self.pushStatusMsg, 'status.push') Publisher.subscribe(self.updateStatusMsg, 'status.update')
def __init__(self, parent, cache): ''' Initialises the View Travel Bugs Frame Arguments parent: The parent window for the dialog. cache: The cache object to display the travel bugs from. ''' wx.Dialog.__init__(self, parent, wx.ID_ANY, _("Travel Bugs for ") + cache.code, size=(420, 500), style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE) res = Xrc.XmlResource( os.path.join(geocacher.getBasePath(), 'xrc', 'bugPanel.xrc')) # Create a scrolled panel and a vertical sizer within it to take the bugs sw = Scrolled.ScrolledPanel(self, -1, size=(400, 450), style=wx.TAB_TRAVERSAL) bugSizer = wx.BoxSizer(orient=wx.VERTICAL) for travelBug in cache.getTravelBugs(): bugPanel = res.LoadPanel(sw, 'bugPanel') ref = Xrc.XRCCTRL(bugPanel, 'refText') name = Xrc.XRCCTRL(bugPanel, 'nameText') ref.SetValue(travelBug.ref) name.SetValue(travelBug.name) bugSizer.Add(bugPanel) # Final Setup of the scrolled panel sw.SetSizer(bugSizer) sw.SetAutoLayout(1) sw.SetupScrolling() # Buttons closeButton = wx.Button(self, wx.ID_CLOSE) self.Bind(wx.EVT_BUTTON, self.OnClose, closeButton) buttonBox = wx.BoxSizer(orient=wx.HORIZONTAL) buttonBox.Add(closeButton, 0, wx.EXPAND) # finally, put the scrolledPannel and buttons in a sizerto manage the layout mainSizer = wx.BoxSizer(orient=wx.VERTICAL) mainSizer.Add(sw) mainSizer.Add(buttonBox, 0, wx.EXPAND) self.SetSizer(mainSizer)
def __init__(self,parent,cache): ''' Initialises the additional waypoints dialog. Arguments parent: The parent window for the dialog. cache: The cache object to display the additional waypoints from. ''' wx.Dialog.__init__(self,parent,wx.ID_ANY,_("Additional Waypoints for ")+cache.code,size = (490,500), style = wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE) # Create a scrolled panel and a vertical sizer within it to take the logs sw = Scrolled.ScrolledPanel(self, -1, size=(480, 450), style = wx.TAB_TRAVERSAL) wptSizer = wx.BoxSizer(orient=wx.VERTICAL) res = Xrc.XmlResource(os.path.join(geocacher.getBasePath(), 'xrc', 'addWaypointsPanel.xrc')) # Create a block for each log and add it to the logs sizer for wpt in cache.getAddWaypoints(): wptPanel = res.LoadPanel(sw, 'addWaypointPanel') code = Xrc.XRCCTRL(wptPanel, 'codeText') wptType = Xrc.XRCCTRL(wptPanel, 'typeText') lat = Xrc.XRCCTRL(wptPanel, 'latText') lon = Xrc.XRCCTRL(wptPanel, 'lonText') name = Xrc.XRCCTRL(wptPanel, 'nameText') comment = Xrc.XRCCTRL(wptPanel, 'commentText') code.SetValue(wpt.code) wptType.SetValue(wpt.sym) lat.SetValue(latToStr(wpt.lat, geocacher.config().coordinateFormat)) lon.SetValue(lonToStr(wpt.lon, geocacher.config().coordinateFormat)) name.SetValue(wpt.name) comment.SetValue(wpt.cmt) wptSizer.Add(wptPanel) # Final Setup of the scrolled panel sw.SetSizer(wptSizer) sw.SetAutoLayout(1) sw.SetupScrolling() # Buttons closeButton = wx.Button(self,wx.ID_CLOSE) self.Bind(wx.EVT_BUTTON, self.OnClose,closeButton) buttonBox = wx.BoxSizer(orient=wx.HORIZONTAL) buttonBox.Add(closeButton, 0, wx.EXPAND) # finally, put the scrolledPannel and buttons in a sizer to manage the layout mainSizer = wx.BoxSizer(orient=wx.VERTICAL) mainSizer.Add(sw) mainSizer.Add(buttonBox, 0, wx.EXPAND) self.SetSizer(mainSizer)
def __init__(self,parent,cache): ''' Initialises the View Logs dialog. Arguments parent: The parent window for the dialog. cache: The cache object to display the logs from. ''' wx.Dialog.__init__(self,parent,wx.ID_ANY,_("Logs for ")+cache.code,size = (650,500), style = wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE) # Create a scrolled panel and a vertical sizer within it to take the logs sw = Scrolled.ScrolledPanel(self, -1, size=(640, 450), style = wx.TAB_TRAVERSAL) logSizer = wx.BoxSizer(orient=wx.VERTICAL) res = Xrc.XmlResource(os.path.join(geocacher.getBasePath(), 'xrc', 'logPanel.xrc')) # Create a block for each log and add it to the logs sizer for log in cache.getLogs(): logPanel = res.LoadPanel(sw, 'logPanel') date = Xrc.XRCCTRL(logPanel, 'dateText') logType = Xrc.XRCCTRL(logPanel, 'typeText') finder = Xrc.XRCCTRL(logPanel, 'finderText') message = Xrc.XRCCTRL(logPanel, 'messageText') date.SetValue(log.date.strftime("%x")) logType.SetValue(log.logType) finder.SetValue(log.finder_name) message.SetValue(log.text) logSizer.Add(logPanel) # Final Setup of the scrolled panel sw.SetSizer(logSizer) sw.SetAutoLayout(1) sw.SetupScrolling() # Buttons closeButton = wx.Button(self,wx.ID_CLOSE) self.Bind(wx.EVT_BUTTON, self.OnClose,closeButton) buttonBox = wx.BoxSizer(orient=wx.HORIZONTAL) buttonBox.Add(closeButton, 0, wx.EXPAND) # finally, put the scrolledPannel and buttons in a sizer to manage the layout mainSizer = wx.BoxSizer(orient=wx.VERTICAL) mainSizer.Add(sw) mainSizer.Add(buttonBox, 0, wx.EXPAND) self.SetSizer(mainSizer)
def __init__(self,parent,cache): ''' Initialises the View Travel Bugs Frame Arguments parent: The parent window for the dialog. cache: The cache object to display the travel bugs from. ''' wx.Dialog.__init__(self,parent,wx.ID_ANY,_("Travel Bugs for ")+cache.code,size = (420,500), style = wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE) res = Xrc.XmlResource(os.path.join(geocacher.getBasePath(), 'xrc', 'bugPanel.xrc')) # Create a scrolled panel and a vertical sizer within it to take the bugs sw = Scrolled.ScrolledPanel(self, -1, size=(400, 450), style = wx.TAB_TRAVERSAL) bugSizer = wx.BoxSizer(orient=wx.VERTICAL) for travelBug in cache.getTravelBugs(): bugPanel = res.LoadPanel(sw, 'bugPanel') ref = Xrc.XRCCTRL(bugPanel, 'refText') name = Xrc.XRCCTRL(bugPanel, 'nameText') ref.SetValue(travelBug.ref) name.SetValue(travelBug.name) bugSizer.Add(bugPanel) # Final Setup of the scrolled panel sw.SetSizer(bugSizer) sw.SetAutoLayout(1) sw.SetupScrolling() # Buttons closeButton = wx.Button(self,wx.ID_CLOSE) self.Bind(wx.EVT_BUTTON, self.OnClose,closeButton) buttonBox = wx.BoxSizer(orient=wx.HORIZONTAL) buttonBox.Add(closeButton, 0, wx.EXPAND) # finally, put the scrolledPannel and buttons in a sizerto manage the layout mainSizer = wx.BoxSizer(orient=wx.VERTICAL) mainSizer.Add(sw) mainSizer.Add(buttonBox, 0, wx.EXPAND) self.SetSizer(mainSizer)
def __init__(self, parent, id): """ Initialisation for the main frame. Arguments parent: The parent window of the frame. id: The ID to give the frame. """ self.displayCache = None size = geocacher.config().mainWinSize # check that the Current location is in the db if geocacher.config().currentLocation not in geocacher.db().getLocationNameList(): geocacher.config().currentLocation = geocacher.db().getLocationNameList()[0] wx.Frame.__init__( self, parent, wx.ID_ANY, _("Geocacher"), size=(size), style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE, ) self.Bind(wx.EVT_CLOSE, self.OnQuit) self.SetIcon(wx.Icon(os.path.join(geocacher.getBasePath(), "gfx", "treasure_chest.ico"), wx.BITMAP_TYPE_ICO)) self.buildStatusBar() self.buildMenu() self.buildToolBar() self.splitter = wx.SplitterWindow(self, wx.ID_ANY, style=wx.SP_LIVE_UPDATE | wx.SP_BORDER) self.cacheGrid = CacheGrid(self.splitter) self.Description = Html.HtmlWindow(self.splitter, wx.ID_ANY, name="Description Pannel") self.splitter.SetMinimumPaneSize(20) self.splitter.SplitHorizontally(self.cacheGrid, self.Description, geocacher.config().detailSplit) self.updateStatus() self.displayedCache = None self.updateDetail(geocacher.config().displayedCache) Publisher.subscribe(self.updateDetailMsg, "cache.selected") Publisher.subscribe(self.NewLocationMsg, "location.new") Publisher.subscribe(self.popStatusMsg, "status.pop") Publisher.subscribe(self.pushStatusMsg, "status.push") Publisher.subscribe(self.updateStatusMsg, "status.update")
def __init__(self, parent): ''' Initialises the dialog from the supplied information Arguments: parent: The parent window ''' self.actions = ['none', 'archive', 'delete'] config = geocacher.config() pre = wx.PreDialog() self.res = Xrc.XmlResource( os.path.join(geocacher.getBasePath(), 'xrc', 'databaseCleanup.xrc')) self.res.LoadOnDialog(pre, parent, 'DatabaseCleanupDialog') self.PostCreate(pre) self.backup = Xrc.XRCCTRL(self, 'backupCheckBox') self.cacheAction = Xrc.XRCCTRL(self, 'cacheActionRadioBox') self.cacheAge = Xrc.XRCCTRL(self, 'cacheAgeSpinCtrl') self.logAge = Xrc.XRCCTRL(self, 'logAgeSpinCtrl') self.indexes = Xrc.XRCCTRL(self, 'indexesCheckBox') self.compact = Xrc.XRCCTRL(self, 'compactCheckBox') self.Bind(wx.EVT_RADIOBOX, self.OnChangeAction, self.cacheAction) self.backup.SetValue(config.cleanupBackup) if (config.cleanupCacheAct) == self.actions[0]: self.cacheAction.SetSelection(0) elif (config.cleanupCacheAct) == self.actions[1]: self.cacheAction.SetSelection(1) else: self.cacheAction.SetSelection(2) self.cacheAge.SetValue(config.cleanupCacheAge) self.logAge.SetValue(config.cleanupLog) self.indexes.SetValue(config.cleanupIndexes) self.compact.SetValue(config.cleanupCompact) if config.cleanupCacheAct == self.actions[0]: self.cacheAge.Disable()
def __init__(self,parent): ''' Initialises the dialog from the supplied information Arguments: parent: The parent window ''' self.actions = ['none', 'archive', 'delete'] config = geocacher.config() pre = wx.PreDialog() self.res = Xrc.XmlResource(os.path.join(geocacher.getBasePath(), 'xrc', 'databaseCleanup.xrc')) self.res.LoadOnDialog(pre, parent, 'DatabaseCleanupDialog') self.PostCreate(pre) self.backup = Xrc.XRCCTRL(self, 'backupCheckBox') self.cacheAction = Xrc.XRCCTRL(self, 'cacheActionRadioBox') self.cacheAge = Xrc.XRCCTRL(self, 'cacheAgeSpinCtrl') self.logAge = Xrc.XRCCTRL(self, 'logAgeSpinCtrl') self.indexes = Xrc.XRCCTRL(self, 'indexesCheckBox') self.compact = Xrc.XRCCTRL(self, 'compactCheckBox') self.Bind(wx.EVT_RADIOBOX, self.OnChangeAction, self.cacheAction) self.backup.SetValue(config.cleanupBackup) if (config.cleanupCacheAct) == self.actions[0]: self.cacheAction.SetSelection(0) elif (config.cleanupCacheAct) == self.actions[1]: self.cacheAction.SetSelection(1) else: self.cacheAction.SetSelection(2) self.cacheAge.SetValue(config.cleanupCacheAge) self.logAge.SetValue(config.cleanupLog) self.indexes.SetValue(config.cleanupIndexes) self.compact.SetValue(config.cleanupCompact) if config.cleanupCacheAct == self.actions[0]: self.cacheAge.Disable()
def __buildDisplayPanel(self, parent): ''' Builds the display preferences panel. Argument parent: the parent window for this panel. ''' panel = wx.Panel(parent, wx.ID_ANY) displayGrid = wx.GridBagSizer(5, 5) label = wx.StaticText(panel, wx.ID_ANY, _('Units'), size=(self.labelWidth, -1)) displayGrid.Add(label, (0, 0)) self.dispUnitsChoices = [_('Kilometers'), _('Miles')] if geocacher.config().imperialUnits: value = self.dispUnitsChoices[1] else: value = self.dispUnitsChoices[0] self.dispUnits = wx.ComboBox(panel, wx.ID_ANY, value=value, choices=self.dispUnitsChoices, style=wx.CB_READONLY, size=(self.entryWidth, -1)) displayGrid.Add(self.dispUnits, (0, 1)) label = wx.StaticText(panel, wx.ID_ANY, _('Coordinate Format')) displayGrid.Add(label, (1, 0)) self.dispCoordFmt = wx.ComboBox( panel, wx.ID_ANY, value=geocacher.config().coordinateFormat, choices=['hdd.ddddd', 'hdd mm.mmm', 'hdd mm ss.s'], style=wx.CB_READONLY, size=(self.entryWidth, -1)) displayGrid.Add(self.dispCoordFmt, (1, 1)) label = wx.StaticText(panel, wx.ID_ANY, _('Icon Theme')) displayGrid.Add(label, (2, 0)) iconThemes = [] for folder in os.listdir(os.path.join(geocacher.getBasePath(), 'gfx')): if os.path.isdir( os.path.join(geocacher.getBasePath(), 'gfx', folder)): iconThemes.append(folder) iconThemes.sort() iconTheme = geocacher.config().iconTheme if iconTheme not in iconThemes: iconTheme = iconThemes[0] self.iconThemeSel = wx.ComboBox(panel, wx.ID_ANY, value=iconTheme, choices=iconThemes, style=wx.CB_READONLY, size=(self.entryWidth, -1)) displayGrid.Add(self.iconThemeSel, (2, 1)) label = wx.StaticText(panel, wx.ID_ANY, _('User Data Column Names')) displayGrid.Add(label, (3, 0), (1, 2)) label = wx.StaticText(panel, wx.ID_ANY, _('User Data 1')) displayGrid.Add(label, (4, 0)) self.dispUserData1 = wx.TextCtrl(panel, wx.ID_ANY, geocacher.config().userData1Label, size=(self.entryWidth, -1)) displayGrid.Add(self.dispUserData1, (4, 1)) label = wx.StaticText(panel, wx.ID_ANY, _('User Data 2')) displayGrid.Add(label, (5, 0)) self.dispUserData2 = wx.TextCtrl(panel, wx.ID_ANY, geocacher.config().userData2Label, size=(self.entryWidth, -1)) displayGrid.Add(self.dispUserData2, (5, 1)) label = wx.StaticText(panel, wx.ID_ANY, _('User Data 3')) displayGrid.Add(label, (6, 0)) self.dispUserData3 = wx.TextCtrl(panel, wx.ID_ANY, geocacher.config().userData4Label, size=(self.entryWidth, -1)) displayGrid.Add(self.dispUserData3, (6, 1)) label = wx.StaticText(panel, wx.ID_ANY, _('User Data 4')) displayGrid.Add(label, (7, 0)) self.dispUserData4 = wx.TextCtrl(panel, wx.ID_ANY, geocacher.config().userData4Label, size=(self.entryWidth, -1)) displayGrid.Add(self.dispUserData4, (7, 1)) panel.SetSizer(displayGrid) return panel
def __init__(self, parent, cache): ''' Initialises the additional waypoints dialog. Arguments parent: The parent window for the dialog. cache: The cache object to display the additional waypoints from. ''' wx.Dialog.__init__(self, parent, wx.ID_ANY, _("Additional Waypoints for ") + cache.code, size=(490, 500), style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE) # Create a scrolled panel and a vertical sizer within it to take the logs sw = Scrolled.ScrolledPanel(self, -1, size=(480, 450), style=wx.TAB_TRAVERSAL) wptSizer = wx.BoxSizer(orient=wx.VERTICAL) res = Xrc.XmlResource( os.path.join(geocacher.getBasePath(), 'xrc', 'addWaypointsPanel.xrc')) # Create a block for each log and add it to the logs sizer for wpt in cache.getAddWaypoints(): wptPanel = res.LoadPanel(sw, 'addWaypointPanel') code = Xrc.XRCCTRL(wptPanel, 'codeText') wptType = Xrc.XRCCTRL(wptPanel, 'typeText') lat = Xrc.XRCCTRL(wptPanel, 'latText') lon = Xrc.XRCCTRL(wptPanel, 'lonText') name = Xrc.XRCCTRL(wptPanel, 'nameText') comment = Xrc.XRCCTRL(wptPanel, 'commentText') code.SetValue(wpt.code) wptType.SetValue(wpt.sym) lat.SetValue(latToStr(wpt.lat, geocacher.config().coordinateFormat)) lon.SetValue(lonToStr(wpt.lon, geocacher.config().coordinateFormat)) name.SetValue(wpt.name) comment.SetValue(wpt.cmt) wptSizer.Add(wptPanel) # Final Setup of the scrolled panel sw.SetSizer(wptSizer) sw.SetAutoLayout(1) sw.SetupScrolling() # Buttons closeButton = wx.Button(self, wx.ID_CLOSE) self.Bind(wx.EVT_BUTTON, self.OnClose, closeButton) buttonBox = wx.BoxSizer(orient=wx.HORIZONTAL) buttonBox.Add(closeButton, 0, wx.EXPAND) # finally, put the scrolledPannel and buttons in a sizer to manage the layout mainSizer = wx.BoxSizer(orient=wx.VERTICAL) mainSizer.Add(sw) mainSizer.Add(buttonBox, 0, wx.EXPAND) self.SetSizer(mainSizer)
def __init__(self, parent, gps=False): ''' Initialises the dialog from the supplied information Arguments: parent: The parent window Keyword Argument gps: True if the dialog is for exporting to GPS rather than file ''' if gps: geocacher.config().exportType = "gps" else: geocacher.config().exportType = "file" self.gps = gps self.gpx = False self.zip = False self.types = ['simple', 'full', 'custom'] pre = wx.PreDialog() self.res = Xrc.XmlResource( os.path.join(geocacher.getBasePath(), 'xrc', 'export.xrc')) self.res.LoadOnDialog(pre, parent, 'ExportWaypointDialog') self.PostCreate(pre) if gps: self.SetTitle(_('Export to GPS options')) else: self.SetTitle(_('Export to file options')) self.displayed = Xrc.XRCCTRL(self, 'displayedCheckBox') self.selected = Xrc.XRCCTRL(self, 'selectedCheckBox') self.userFlag = Xrc.XRCCTRL(self, 'userFlagCheckBox') self.path = Xrc.XRCCTRL(self, 'pathPicker') self.gpsLabel = Xrc.XRCCTRL(self, 'gpsLabel') self.exType = Xrc.XRCCTRL(self, 'typeRadioBox') self.gc = Xrc.XRCCTRL(self, 'extensionsCheckBox') self.logs = Xrc.XRCCTRL(self, 'logsCheckBox') self.tbs = Xrc.XRCCTRL(self, 'travelBugsCheckBox') self.addWpts = Xrc.XRCCTRL(self, 'addWptsCheckBox') self.sepAddWpts = Xrc.XRCCTRL(self, 'sepAddWptsCheckBox') self.adjWpts = Xrc.XRCCTRL(self, 'adjustedCheckBox') self.adjWptSufix = Xrc.XRCCTRL(self, 'adjWptSufixText') self.limitLogs = Xrc.XRCCTRL(self, 'limitLogsCheckBox') self.maxLogs = Xrc.XRCCTRL(self, 'limitLogsSpin') self.logOrder = Xrc.XRCCTRL(self, 'logSortRadioBox') self.gpxVersion = Xrc.XRCCTRL(self, 'versionRadioBox') self.Bind(wx.EVT_FILEPICKER_CHANGED, self.OnPathChanged, self.path) self.Bind(wx.EVT_RADIOBOX, self.OnChangeType, self.exType) self.Bind(wx.EVT_CHECKBOX, self.OnToggleGc, self.gc) self.Bind(wx.EVT_CHECKBOX, self.OnToggleAddWpts, self.addWpts) self.Bind(wx.EVT_CHECKBOX, self.OnToggleAdjWpts, self.adjWpts) self.Bind(wx.EVT_CHECKBOX, self.OnToggleLimitLogs, self.limitLogs) self.displayed.SetValue(geocacher.config().exportFilterDisp) self.selected.SetValue(geocacher.config().exportFilterSel) self.userFlag.SetValue(geocacher.config().exportFilterUser) if gps: self.path.Disable() self.path.Hide() self.sepAddWpts.Hide() self.gpx = True else: self.gpsLabel.Hide() if os.path.isfile(geocacher.config().exportFile): self.path.SetPath(geocacher.config().exportFile) ext = os.path.splitext(geocacher.config().exportFile)[1] if ext == '.zip': self.zip = True self.gpx = True elif ext == '.gpx': self.gpx = True self.exType.Disable() self.gc.Disable() self.logs.Disable() self.tbs.Disable() self.addWpts.Disable() self.sepAddWpts.Disable() if self.gpx: self.exType.Enable() if (geocacher.config().exportScope) == self.types[0]: self.exType.SetSelection(0) elif (geocacher.config().exportScope) == self.types[1]: self.exType.SetSelection(1) if self.zip: self.sepAddWpts.Enable() self.sepAddWpts.SetValue( geocacher.config().exportSepAddWpts) else: self.exType.SetSelection(2) self.gc.Enable() self.gc.SetValue(geocacher.config().exportGc) if self.gc.GetValue(): self.logs.Enable() self.logs.SetValue(geocacher.config().exportLogs) self.tbs.Enable() self.tbs.SetValue(geocacher.config().exportTbs) self.addWpts.Enable() self.addWpts.SetValue(geocacher.config().exportAddWpts) if self.zip and self.addWpts.GetValue(): self.sepAddWpts.Enable() self.sepAddWpts.SetValue( geocacher.config().exportSepAddWpts) self.adjWpts.SetValue(geocacher.config().exportAdjWpts) self.adjWptSufix.SetValue(geocacher.config().exportAdjWptSufix) if not self.adjWpts.GetValue(): self.adjWptSufix.Disable() self.limitLogs.SetValue(geocacher.config().exportLimitLogs) self.maxLogs.SetValue(geocacher.config().exportMaxLogs) if not self.limitLogs.GetValue(): self.maxLogs.Disable() self.logOrder.SetSelection(geocacher.config().exportLogOrder) self.gpxVersion.SetSelection(geocacher.config().exportGpxVersion)
def __init__(self,parent,gps=False): ''' Initialises the dialog from the supplied information Arguments: parent: The parent window Keyword Argument gps: True if the dialog is for exporting to GPS rather than file ''' if gps: geocacher.config().exportType = "gps" else: geocacher.config().exportType = "file" self.gps = gps self.gpx = False self.zip = False self.types = ['simple','full','custom'] pre = wx.PreDialog() self.res = Xrc.XmlResource(os.path.join(geocacher.getBasePath(), 'xrc', 'export.xrc')) self.res.LoadOnDialog(pre, parent, 'ExportWaypointDialog') self.PostCreate(pre) if gps: self.SetTitle(_('Export to GPS options')) else: self.SetTitle(_('Export to file options')) self.displayed = Xrc.XRCCTRL(self, 'displayedCheckBox') self.selected = Xrc.XRCCTRL(self, 'selectedCheckBox') self.userFlag = Xrc.XRCCTRL(self, 'userFlagCheckBox') self.path = Xrc.XRCCTRL(self, 'pathPicker') self.gpsLabel = Xrc.XRCCTRL(self, 'gpsLabel') self.exType = Xrc.XRCCTRL(self, 'typeRadioBox') self.gc = Xrc.XRCCTRL(self, 'extensionsCheckBox') self.logs = Xrc.XRCCTRL(self, 'logsCheckBox') self.tbs = Xrc.XRCCTRL(self, 'travelBugsCheckBox') self.addWpts = Xrc.XRCCTRL(self, 'addWptsCheckBox') self.sepAddWpts = Xrc.XRCCTRL(self, 'sepAddWptsCheckBox') self.adjWpts = Xrc.XRCCTRL(self, 'adjustedCheckBox') self.adjWptSufix = Xrc.XRCCTRL(self, 'adjWptSufixText') self.limitLogs = Xrc.XRCCTRL(self, 'limitLogsCheckBox') self.maxLogs = Xrc.XRCCTRL(self, 'limitLogsSpin') self.logOrder = Xrc.XRCCTRL(self, 'logSortRadioBox') self.gpxVersion = Xrc.XRCCTRL(self, 'versionRadioBox') self.Bind(wx.EVT_FILEPICKER_CHANGED, self.OnPathChanged, self.path) self.Bind(wx.EVT_RADIOBOX, self.OnChangeType, self.exType) self.Bind(wx.EVT_CHECKBOX, self.OnToggleGc, self.gc) self.Bind(wx.EVT_CHECKBOX, self.OnToggleAddWpts, self.addWpts) self.Bind(wx.EVT_CHECKBOX, self.OnToggleAdjWpts, self.adjWpts) self.Bind(wx.EVT_CHECKBOX, self.OnToggleLimitLogs, self.limitLogs) self.displayed.SetValue(geocacher.config().exportFilterDisp) self.selected.SetValue(geocacher.config().exportFilterSel) self.userFlag.SetValue(geocacher.config().exportFilterUser) if gps: self.path.Disable() self.path.Hide() self.sepAddWpts.Hide() self.gpx = True else: self.gpsLabel.Hide() if os.path.isfile(geocacher.config().exportFile): self.path.SetPath(geocacher.config().exportFile) ext = os.path.splitext(geocacher.config().exportFile)[1] if ext == '.zip': self.zip = True self.gpx = True elif ext == '.gpx': self.gpx = True self.exType.Disable() self.gc.Disable() self.logs.Disable() self.tbs.Disable() self.addWpts.Disable() self.sepAddWpts.Disable() if self.gpx: self.exType.Enable() if (geocacher.config().exportScope) == self.types[0]: self.exType.SetSelection(0) elif (geocacher.config().exportScope) == self.types[1]: self.exType.SetSelection(1) if self.zip: self.sepAddWpts.Enable() self.sepAddWpts.SetValue(geocacher.config().exportSepAddWpts) else: self.exType.SetSelection(2) self.gc.Enable() self.gc.SetValue(geocacher.config().exportGc) if self.gc.GetValue(): self.logs.Enable() self.logs.SetValue(geocacher.config().exportLogs) self.tbs.Enable() self.tbs.SetValue(geocacher.config().exportTbs) self.addWpts.Enable() self.addWpts.SetValue(geocacher.config().exportAddWpts) if self.zip and self.addWpts.GetValue(): self.sepAddWpts.Enable() self.sepAddWpts.SetValue(geocacher.config().exportSepAddWpts) self.adjWpts.SetValue(geocacher.config().exportAdjWpts) self.adjWptSufix.SetValue(geocacher.config().exportAdjWptSufix) if not self.adjWpts.GetValue(): self.adjWptSufix.Disable() self.limitLogs.SetValue(geocacher.config().exportLimitLogs) self.maxLogs.SetValue(geocacher.config().exportMaxLogs) if not self.limitLogs.GetValue(): self.maxLogs.Disable() self.logOrder.SetSelection(geocacher.config().exportLogOrder) self.gpxVersion.SetSelection(geocacher.config().exportGpxVersion)
def __buildDisplayPanel(self, parent): ''' Builds the display preferences panel. Argument parent: the parent window for this panel. ''' panel = wx.Panel(parent, wx.ID_ANY) displayGrid = wx.GridBagSizer(5, 5) label = wx.StaticText(panel,wx.ID_ANY,_('Units'), size = (self.labelWidth,-1)) displayGrid.Add(label, (0,0)) self.dispUnitsChoices = [_('Kilometers'), _('Miles')] if geocacher.config().imperialUnits: value = self.dispUnitsChoices[1] else: value = self.dispUnitsChoices[0] self.dispUnits = wx.ComboBox(panel, wx.ID_ANY, value=value, choices=self.dispUnitsChoices, style=wx.CB_READONLY, size = (self.entryWidth,-1)) displayGrid.Add(self.dispUnits, (0,1)) label = wx.StaticText(panel,wx.ID_ANY,_('Coordinate Format')) displayGrid.Add(label, (1,0)) self.dispCoordFmt = wx.ComboBox(panel, wx.ID_ANY, value=geocacher.config().coordinateFormat, choices=['hdd.ddddd', 'hdd mm.mmm', 'hdd mm ss.s'], style=wx.CB_READONLY, size = (self.entryWidth,-1)) displayGrid.Add(self.dispCoordFmt, (1,1)) label = wx.StaticText(panel,wx.ID_ANY,_('Icon Theme')) displayGrid.Add(label, (2,0)) iconThemes=[] for folder in os.listdir(os.path.join(geocacher.getBasePath(),'gfx')): if os.path.isdir(os.path.join(geocacher.getBasePath(),'gfx',folder)): iconThemes.append(folder) iconThemes.sort() iconTheme = geocacher.config().iconTheme if iconTheme not in iconThemes: iconTheme = iconThemes[0] self.iconThemeSel = wx.ComboBox(panel, wx.ID_ANY, value=iconTheme, choices=iconThemes, style=wx.CB_READONLY, size = (self.entryWidth,-1)) displayGrid.Add(self.iconThemeSel, (2,1)) label = wx.StaticText(panel,wx.ID_ANY, _('User Data Column Names')) displayGrid.Add(label, (3,0), (1,2)) label = wx.StaticText(panel,wx.ID_ANY,_('User Data 1')) displayGrid.Add(label, (4,0)) self.dispUserData1 = wx.TextCtrl(panel, wx.ID_ANY, geocacher.config().userData1Label, size = (self.entryWidth,-1)) displayGrid.Add(self.dispUserData1, (4,1)) label = wx.StaticText(panel,wx.ID_ANY,_('User Data 2')) displayGrid.Add(label, (5,0)) self.dispUserData2 = wx.TextCtrl(panel, wx.ID_ANY, geocacher.config().userData2Label, size = (self.entryWidth,-1)) displayGrid.Add(self.dispUserData2, (5,1)) label = wx.StaticText(panel,wx.ID_ANY,_('User Data 3')) displayGrid.Add(label, (6,0)) self.dispUserData3 = wx.TextCtrl(panel, wx.ID_ANY, geocacher.config().userData4Label, size = (self.entryWidth,-1)) displayGrid.Add(self.dispUserData3, (6,1)) label = wx.StaticText(panel,wx.ID_ANY,_('User Data 4')) displayGrid.Add(label, (7,0)) self.dispUserData4 = wx.TextCtrl(panel, wx.ID_ANY, geocacher.config().userData4Label, size = (self.entryWidth,-1)) displayGrid.Add(self.dispUserData4, (7,1)) panel.SetSizer(displayGrid) return panel