def __init__(self, parent, env, url="", show_browser_ui=True): wx.Panel.__init__(self, parent) self.env = env self.show_browser_ui = show_browser_ui self.sig_title_changed = Signal() self.sig_status_changed = Signal() import wx.html2 as webview self.wv = webview.WebView.New(self, url=url) sizer = wx.BoxSizer(wx.VERTICAL) if show_browser_ui: btnSizer = wx.BoxSizer(wx.HORIZONTAL) btn = wx.BitmapButton(self, bitmap=resources.load_bitmap("icons/back.png")) self.Bind(wx.EVT_BUTTON, self.OnBack, btn) self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI_Back, btn) btnSizer.Add(btn, 0, wx.EXPAND|wx.ALL, 2) btn = wx.BitmapButton(self, bitmap=resources.load_bitmap("icons/forward.png")) self.Bind(wx.EVT_BUTTON, self.OnForward, btn) self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI_Forward, btn) btnSizer.Add(btn, 0, wx.EXPAND|wx.ALL, 2) btn = wx.BitmapButton(self, bitmap=resources.load_bitmap("icons/stop.png")) self.Bind(wx.EVT_BUTTON, self.OnStop, btn) self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI_Stop, btn) btnSizer.Add(btn, 0, wx.EXPAND|wx.ALL, 2) btn = wx.BitmapButton(self, bitmap=resources.load_bitmap("icons/refresh.png")) self.Bind(wx.EVT_BUTTON, self.OnRefresh, btn) self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI_Refresh, btn) btnSizer.Add(btn, 0, wx.EXPAND|wx.ALL, 2) self.location = wx.ComboBox(self, value=url, style=wx.CB_DROPDOWN|wx.TE_PROCESS_ENTER) self.Bind(wx.EVT_COMBOBOX, self.OnLocationSelect, self.location) self.location.Bind(wx.EVT_TEXT_ENTER, self.OnLocationEnter) btnSizer.Add(self.location, 1, wx.ALIGN_CENTRE_VERTICAL|wx.ALL, 2) sizer.Add(btnSizer, 0, wx.EXPAND) sizer.Add(self.wv, 1, wx.EXPAND) self.SetSizer(sizer) self.Bind(webview.EVT_WEBVIEW_NAVIGATING, self.OnWebViewNavigating, self.wv) self.Bind(webview.EVT_WEBVIEW_LOADED, self.OnWebViewLoaded, self.wv) self.Bind(webview.EVT_WEBVIEW_TITLE_CHANGED, self.OnWebViewTitleChanged, self.wv)
def __init__(self, parent, filter=None, show_root=False): style = wx.TR_DEFAULT_STYLE | wx.TR_EDIT_LABELS | wx.BORDER_NONE if not show_root: style |= wx.TR_HIDE_ROOT wx.TreeCtrl.__init__(self, parent, style=style) wx.FileDropTarget.__init__(self) self.SetDropTarget(self) self.SetDoubleBuffered(True) old_font = self.GetFont() self.font = wx.Font(old_font.PointSize, old_font.Family, old_font.Style, old_font.Weight, faceName=old_font.FaceName) self.SetFont(self.font) self.filter = filter or DirTreeFilter() self.cq = CoroutineQueue() self.cm = CoroutineManager() self.select_later_parent = None self.select_later_name = None self.select_later_time = 0 self.expanding_all = False self.drop_item = None self.sig_update_tree = Signal(self) self.sig_update_tree.bind(self.UpdateFromFSMonitor) self.monitor = FSMonitor() self.monitor_thread = DirTreeMonitor(self, self.monitor) self.imglist = wx.ImageList(16, 16) self.imglist.Add(load_bitmap("icons/folder.png")) self.imglist.Add(load_bitmap("icons/folder_denied.png")) self.imglist.Add(load_bitmap("icons/file.png")) self.SetImageList(self.imglist) self.Bind(wx.EVT_TREE_ITEM_EXPANDING, self.OnItemExpanding) self.Bind(wx.EVT_TREE_ITEM_COLLAPSED, self.OnItemCollapsed) self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.OnItemRightClicked) self.Bind(wx.EVT_TREE_BEGIN_LABEL_EDIT, self.OnItemBeginLabelEdit) self.Bind(wx.EVT_TREE_END_LABEL_EDIT, self.OnItemEndLabelEdit) self.Bind(wx.EVT_TREE_BEGIN_DRAG, self.OnBeginDrag) self.Bind(wx.EVT_MENU, self.OnItemRename, id=ID_DIRTREE_RENAME) self.Bind(wx.EVT_MENU, self.OnItemDelete, id=ID_DIRTREE_DELETE) self.Bind(wx.EVT_MENU, self.OnNewFolder, id=ID_DIRTREE_NEW_FOLDER) self.Bind(wx.EVT_MENU, self.OnExpandAll, id=ID_DIRTREE_EXPAND_ALL) self.Bind(wx.EVT_MENU, self.OnCollapseAll, id=ID_DIRTREE_COLLAPSE_ALL)
def __init__(self, parent, env): wx.Dialog.__init__(self, parent, title="About " + app_info.name) self.env = env logo_font_size = 25 if sys.platform == "__WXMAC__" else 20 subtitle_font_size = 24 if sys.platform == "__WXMAC__" else 10 version_text = "Version %s (Released %s)" % ( app_info.version_string, app_info.release_date.strftime("%Y-%m-%d"), ) bitmap_devo = wx.StaticBitmap(self) bitmap_devo.SetBitmap(resources.load_bitmap("icons/devo-icon-64.png")) fontsize = self.GetFont().PointSize label_devo = wx.StaticText(self, label=app_info.name) label_devo.SetFont(wx.Font(fontsize * 2.5, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD)) label_devolved = wx.StaticText(self, label=" Text Editing Devolved") label_devolved.SetFont(wx.Font(fontsize * 1.25, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_ITALIC, wx.FONTWEIGHT_NORMAL)) label_version = wx.StaticText(self, label=version_text) label_developer = wx.StaticText(self, label=app_info.developer) link_website = HyperLinkCtrl(self, wx.ID_ANY, label=app_info.url, url=app_info.url) btn_sizer = wx.BoxSizer(wx.HORIZONTAL) btn_license = wx.Button(self, label="License") btn_ok = wx.Button(self, wx.ID_OK) btn_ok.SetDefault() btn_sizer.Add(btn_license) btn_sizer.AddStretchSpacer() btn_sizer.Add(btn_ok) logo_text_sizer = wx.BoxSizer(wx.VERTICAL) logo_text_sizer.Add(label_devo, 0, wx.LEFT | wx.RIGHT | wx.TOP, 10) logo_text_sizer.Add(label_devolved, 0, wx.LEFT | wx.RIGHT, 10) logo_sizer = wx.BoxSizer(wx.HORIZONTAL) logo_sizer.Add(bitmap_devo, 0, wx.ALIGN_CENTER_VERTICAL) logo_sizer.Add(logo_text_sizer, 1, wx.ALIGN_CENTER_VERTICAL) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(logo_sizer, 0, wx.LEFT | wx.RIGHT | wx.TOP, 20) sizer.AddSpacer(15) sizer.Add(label_version, 0, wx.LEFT | wx.RIGHT, 20) sizer.AddSpacer(5) sizer.Add(label_developer, 0, wx.LEFT | wx.RIGHT, 20) sizer.AddSpacer(5) sizer.Add(link_website, 0, wx.LEFT | wx.RIGHT, 20) sizer.AddSpacer(5) sizer.Add(btn_sizer, 0, wx.ALL | wx.EXPAND, 10) self.SetSizer(sizer) self.Fit() self.Centre() self.Bind(wx.EVT_BUTTON, self.OnLicense, btn_license)