def __init__(self, parent): # make that the plugin info is displayed in the middle of the screen frame_w = 320 frame_h = 250 x = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_X)//2 - frame_w//2 y = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_Y)//2 - frame_h//2 wx.Frame.__init__(self, parent, title="Plugin Info", pos=(x, y), size=(frame_w, frame_h)) # Frame icon ib = wx.IconBundle() icon_32 = wx.EmptyIcon() icon_32.CopyFromBitmap(wx.Bitmap(os.path.join(self.icon_folder, "favicon_32.png"), wx.BITMAP_TYPE_ANY)) ib.AddIcon(icon_32) icon_48 = wx.EmptyIcon() icon_48.CopyFromBitmap(wx.Bitmap(os.path.join(self.icon_folder, "favicon_48.png"), wx.BITMAP_TYPE_ANY)) ib.AddIcon(icon_48) self.SetIcons(ib) p = wx.Panel(self) nb = wx.Notebook(p) for store in compass_model.get_stores(): try: # log.debug(store.plugin_name()) # log.debug(store.plugin_description()) pnl = wx.Panel(nb) t = rtc.RichTextCtrl(pnl, -1, style=wx.TE_READONLY) t.BeginFontSize(9) t.BeginAlignment(wx.TEXT_ALIGNMENT_CENTRE) t.BeginBold() t.WriteText("Name: ") t.EndBold() t.BeginItalic() t.WriteText(store.plugin_name()) t.EndItalic() t.Newline() t.Newline() t.BeginBold() t.WriteText("Description") t.EndBold() t.Newline() t.BeginItalic() t.WriteText(store.plugin_description()) t.EndItalic() t.Newline() #store.plugin_description(), style=wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_CENTER) szr = wx.BoxSizer() szr.Add(t, 1, wx.ALL|wx.EXPAND, 5) pnl.SetSizer(szr) nb.AddPage(pnl, store.plugin_name()) except NotImplementedError: # skip not implemented plugin name/description log.debug("Not implemented name/description for %s" % store) sizer = wx.BoxSizer() sizer.Add(nb, 1, wx.ALL | wx.EXPAND, 3) p.SetSizer(sizer)
def can_open_store(url): """ checks url for first matching registered Store class. Returns True if the url can be successfully opened, False otherwise. """ stores = [x for x in compass_model.get_stores() if x.can_handle(url)] if len(stores) > 0: instance = stores[0](url) return True return False
def open_store(url): """ Open the url using the first matching registered Store class. Returns True if the url was successfully opened, False otherwise. """ stores = [x for x in compass_model.get_stores() if x.can_handle(url)] if len(stores) > 0: instance = stores[0](url) open_node(instance.root) return True return False
def make_filter_string(): """ Make a wxPython dialog filter string segment from dict """ filter_string = [] hdf_filter_string = [] # put HDF filters in the front for store in compass_model.get_stores(): if len(store.file_extensions) == 0: continue for key in store.file_extensions: s = "{name} ({pattern_c})|{pattern_sc}".format( name=key, pattern_c=",".join(store.file_extensions[key]), pattern_sc=";".join(store.file_extensions[key])) if s.startswith("HDF"): hdf_filter_string.append(s) else: filter_string.append(s) filter_string = hdf_filter_string + filter_string filter_string.append('All Files (*.*)|*.*') pipe = "|" return pipe.join(filter_string)
def make_filter_string(): """ Make a wxPython dialog filter string segment from dict """ filter_string = [] hdf_filter_string = [] # put HDF filters in the front for store in compass_model.get_stores(): if len(store.file_extensions) == 0: continue for key in store.file_extensions: s = "{name} ({pattern_c})|{pattern_sc}".format( name=key, pattern_c=",".join(store.file_extensions[key]), pattern_sc=";".join(store.file_extensions[key]) ) if s.startswith("BAG"): hdf_filter_string.append(s) else: filter_string.append(s) filter_string = hdf_filter_string + filter_string filter_string.append('All Files (*.*)|*.*') pipe = "|" return pipe.join(filter_string)
def __init__(self, parent): # make that the plugin info is displayed in the middle of the screen frame_w = 320 frame_h = 250 x = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_X) // 2 - frame_w // 2 y = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_Y) // 2 - frame_h // 2 wx.Frame.__init__(self, parent, title="Plugin Info", pos=(x, y), size=(frame_w, frame_h)) # Frame icon ib = wx.IconBundle() icon_32 = wx.EmptyIcon() icon_32.CopyFromBitmap( wx.Bitmap(os.path.join(self.icon_folder, "favicon_32.png"), wx.BITMAP_TYPE_ANY)) ib.AddIcon(icon_32) icon_48 = wx.EmptyIcon() icon_48.CopyFromBitmap( wx.Bitmap(os.path.join(self.icon_folder, "favicon_48.png"), wx.BITMAP_TYPE_ANY)) ib.AddIcon(icon_48) self.SetIcons(ib) p = wx.Panel(self) nb = wx.Notebook(p) for store in compass_model.get_stores(): try: # log.debug(store.plugin_name()) # log.debug(store.plugin_description()) pnl = wx.Panel(nb) t = rtc.RichTextCtrl(pnl, -1, style=wx.TE_READONLY) t.BeginFontSize(9) t.BeginAlignment(wx.TEXT_ALIGNMENT_CENTRE) t.BeginBold() t.WriteText("Name: ") t.EndBold() t.BeginItalic() t.WriteText(store.plugin_name()) t.EndItalic() t.Newline() t.Newline() t.BeginBold() t.WriteText("Description") t.EndBold() t.Newline() t.BeginItalic() t.WriteText(store.plugin_description()) t.EndItalic() t.Newline() #store.plugin_description(), style=wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_CENTER) szr = wx.BoxSizer() szr.Add(t, 1, wx.ALL | wx.EXPAND, 5) pnl.SetSizer(szr) nb.AddPage(pnl, store.plugin_name()) except NotImplementedError: # skip not implemented plugin name/description log.debug("Not implemented name/description for %s" % store) sizer = wx.BoxSizer() sizer.Add(nb, 1, wx.ALL | wx.EXPAND, 3) p.SetSizer(sizer)