def __init__(self, parent, code): ##########版本号 wx.Panel.__init__(self, parent, -1) # 主sizer self.code_sizer_v1 = wx.BoxSizer(wx.VERTICAL) ##登录图标 self.code_bmp_account = wx.StaticBitmap(self, -1) self.code_bmp_account.SetBitmap(wx.Bitmap('login.png')) self.code_sizer_v1.Add(self.code_bmp_account, flag=wx.ALIGN_CENTER_HORIZONTAL | wx.TOP, border=15) self.code_userbox = wx.BoxSizer(wx.HORIZONTAL) self.code_userlabel = wx.StaticText(self, -1, label="激活码") self.code_userText = wx.TextCtrl(self, -1, size=(139, -1), style=wx.TE_CENTER | wx.TE_PROCESS_ENTER) # self.code_userText.Bind(wx.EVT_KEY_DOWN , self.code_veritify) # self.userbox.Add(self.bmp_account) self.code_userbox.Add(self.code_userlabel, flag=wx.ALIGN_CENTER | wx.ALL, border=5) self.code_userbox.Add(self.code_userText, flag=wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, border=5) self.code_sizer_v1.Add(self.code_userbox, flag=wx.ALIGN_CENTER | wx.ALL, border=10) self.Bind(wx.EVT_TEXT_ENTER, self.OnLogin, self.code_userText) self.code_purchasebtn = wx.Button(self, -1, label="购买激活码", size=(90, 30)) self.code_loginbtn = wx.Button(self, -1, label="登录", size=(90, 30)) # self.code_monibtn.SetBackgroundColour('#ff6b3b') # self.code_loginbtn.SetBackgroundColour('#ff6b3b') self.code_btnSizer = wx.BoxSizer(wx.HORIZONTAL) self.code_btnSizer.Add(self.code_purchasebtn, flag=wx.ALIGN_LEFT | wx.ALL, border=3) self.code_btnSizer.Add(self.code_loginbtn, flag=wx.ALIGN_RIGHT | wx.ALL, border=3) self.code_sizer_v1.Add(self.code_btnSizer, flag=wx.ALIGN_CENTER | wx.ALL, border=5) self.code_loginbtn.Bind(wx.EVT_BUTTON, self.OnLogin) self.code_purchasebtn.Bind(wx.EVT_BUTTON, self.OnPurchase) ##初始化 if code: self.code_userText.SetValue(code) self.purchaselink = hyperlink.HyperLinkCtrl(self, -1, u"查看教程", URL="https://hupai.pro/purchase_software") self.purchaselink.UnsetToolTip() self.purchaselink.Bind(hyperlink.EVT_HYPERLINK_LEFT, self.Purchase) self.purchaselink.AutoBrowse(False) self.purchaselink.EnableRollover(True) self.purchaselink.SetUnderlines(False, False, True) self.purchaselink.OpenInSameWindow(True) self.purchaselink.UpdateLink() self.helplink = hyperlink.HyperLinkCtrl(self, -1, u"联系我们", URL="https://hupai.pro/purchase_software") self.helplink.UnsetToolTip() self.helplink.Bind(hyperlink.EVT_HYPERLINK_LEFT, self.Purchase) self.helplink.AutoBrowse(False) self.helplink.EnableRollover(True) self.helplink.SetUnderlines(False, False, True) self.helplink.OpenInSameWindow(True) self.helplink.UpdateLink() self.linkbox = wx.BoxSizer(wx.HORIZONTAL) self.linkbox.Add(self.purchaselink, flag=wx.ALIGN_LEFT | wx.RIGHT, border=20) self.linkbox.Add(self.helplink, flag=wx.ALIGN_RIGHT | wx.LEFT, border=20) self.code_sizer_v1.Add(self.linkbox, flag=wx.ALIGN_CENTER | wx.ALL, border=5) self.SetSizer(self.code_sizer_v1)
def _build_links(self, sizer): panel2 = wx.Panel(self.panel, -1) hyper1 = hl.HyperLinkCtrl( panel2, -1, "Git Hub", pos=(25, 0), URL="https://github.com/Samuzero15/pack-o-daemon") hyper1.SetToolTip(wx.ToolTip("The Pack-O-Daemon Git Hub repository!")) hyper1.EnableRollover(True) hyper2 = hl.HyperLinkCtrl(panel2, -1, "Discord", pos=(90, 0), URL="#") hyper2.SetToolTip( wx.ToolTip( "Samu's Chambers Discord.\nTalk to the author here too.")) hyper2.EnableRollover(True) hyper3 = hl.HyperLinkCtrl(panel2, -1, "Patch Notes", pos=(150, 0)) hyper3.SetToolTip(wx.ToolTip("What's new in this version?")) hyper3.AutoBrowse(False) self.Bind(hl.EVT_HYPERLINK_LEFT, self.OnChangelog, hyper3) sizer.Add(panel2, 0, wx.CENTER | wx.ALL, 1) return sizer
def __init__(self, parent, version): wx.Dialog.__init__(self, parent, title="Check For Updates") self.version = version self.latestVersion = [] panel = wx.Panel(self) sizer = wx.BoxSizer(wx.VERTICAL) sbox = wx.StaticBox(panel, label="") sboxSizer = wx.StaticBoxSizer(sbox, wx.VERTICAL) v = "v" + ".".join([str(s) for s in version]) versionLabel = wx.StaticText(panel, label="Current Version: %s" % v) self.latestVersionLabel = wx.StaticText(panel, label="Latest Version:") self.versionStatus = wx.StaticText(panel, label="") g = "https://sourceforge.net/projects/advanced-action-scheduler/files/" link = hyperlink.HyperLinkCtrl(panel, label="Check Releases Manually", URL=g) hSizerLink = wx.BoxSizer(wx.HORIZONTAL) self.linkLabel = wx.StaticText(panel) self.link = hyperlink.HyperLinkCtrl(panel, label="", URL=g) hSizerLink.Add(self.linkLabel, 0, wx.ALL|wx.ALIGN_CENTER, 5) hSizerLink.Add(self.link, 0, wx.ALL|wx.EXPAND, 5) sboxSizer.Add(link, 0, wx.ALL|wx.EXPAND, 5) sboxSizer.Add(versionLabel, 0, wx.ALL|wx.EXPAND, 5) sboxSizer.Add(self.latestVersionLabel, 0, wx.ALL|wx.EXPAND, 5) sboxSizer.Add(self.versionStatus, 0, wx.ALL|wx.EXPAND, 5) sboxSizer.Add(hSizerLink, 1, wx.ALL|wx.EXPAND, 5) hSizer = wx.BoxSizer(wx.HORIZONTAL) self.btnCancel = wx.Button(panel, label="Cancel", id=wx.ID_CANCEL) self.btnCheck = wx.Button(panel, label="Check") self.btnCheck.SetFocus() # self.btnUpdate = wx.Button(panel, label="Update") # self.btnUpdate.Disable() self.btnCancel.Bind(wx.EVT_BUTTON, self.OnCancel) self.btnCheck.Bind(wx.EVT_BUTTON, self.OnCheck) # self.btnUpdate.Bind(wx.EVT_BUTTON, self.OnUpdate) hSizer.Add(self.btnCancel, 0, wx.ALL|wx.EXPAND, 5) hSizer.AddStretchSpacer() hSizer.Add(self.btnCheck, 0, wx.ALL|wx.EXPAND, 5) # hSizer.Add(self.btnUpdate, 0, wx.ALL|wx.EXPAND, 5) #add to main sizer sizer.Add(sboxSizer, 1, wx.ALL|wx.EXPAND, 5) sizer.Add(hSizer, 0, wx.ALL|wx.EXPAND, 5) panel.SetSizer(sizer) w, h = sizer.Fit(self) self.SetMinSize((w*1.5, h)) self.SetSize((w*1.5, h)) self.Show() self.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.OnTimer, self.timer)
def OnContentsSelect(self, event=None): self.rightSizer.Clear(delete_windows=True) if self.contentSelection == -1: return layout = LAYOUTS[self.contentSelectionText()] for contentType, content in layout: if contentType == "html": html = wx.html2.WebView.New(self.rightPanel) html.EnableContextMenu(False) html.Bind(wx.html2.EVT_WEBVIEW_NAVIGATING, lambda x: -1) html.Bind(wx.EVT_LEFT_UP, lambda x: -1) html.Bind(wx.EVT_LEFT_UP, lambda x: -1) html.LoadURL("file://{0}/docs/userguide/en/{1}.html".format( CWD, content)) self.rightSizer.Add(html, 1, wx.ALL | wx.EXPAND, 5) elif contentType == "text": text = wx.TextCtrl(self.rightPanel, value=content, style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH | wx.BORDER_NONE) self.rightSizer.Add(text, 1, wx.ALL | wx.EXPAND, 5) elif contentType == "tree": tree = base.TreeListCtrl(self.rightPanel) tree.AppendColumn("Schedule") tree.Bind(wx.EVT_CHAR, lambda x: 0) tree.Bind(wx.dataview.EVT_TREELIST_ITEM_CHECKED, self.OnTreeCheck) tree.SetTree(content["schedules"]) self.rightSizer.Add(tree, 1, wx.ALL | wx.EXPAND, 5) if self.contentSelectionText() == "Support": text = wx.StaticText(self.rightPanel) t = ( "If you encounter any issues or would like to submit a feature request," + "head over to the SourceForge homepage or the Github homepage") text.SetLabel(t) self.rightSizer.Add(text, 0, wx.ALL | wx.EXPAND, 5) g = "https://github.com/swprojects/Advanced-Action-Scheduler" link = hyperlink.HyperLinkCtrl(self.rightPanel, label="Github Page", URL=g) self.rightSizer.Add(link, 0, wx.ALL | wx.EXPAND, 5) s = "https://sourceforge.net/projects/advanced-action-scheduler/" link = hyperlink.HyperLinkCtrl(self.rightPanel, label="SourceForge Page", URL=s) self.rightSizer.Add(link, 0, wx.ALL | wx.EXPAND, 5) self.rightSizer.Layout()
def setupMenuBar(self): self.CreateStatusBar() menu_file = wx.Menu() mnu_new = menu_file.Append(wx.ID_NEW, "N&ew", "New template") mnu_open = menu_file.Append(wx.ID_OPEN, "O&pen", "Open template") self.multiID = wx.NewId() mnu_multi = menu_file.Append(self.multiID, "M&ulti", "Multiple targets configuration") mnu_exit = menu_file.Append(wx.ID_EXIT, "E&xit", "Exit program") menu_settings = wx.Menu() menu_view = wx.Menu() #self.viewSingleScheduleID = wx.NewId() #mnu_view = menu_view.Append(self.viewSingleScheduleID, "&Single Schedule List", "Single Schedule List") #self.viewMultipleScheduleID = wx.NewId() #mnu_view = menu_view.Append(self.viewMultipleScheduleID, "&Multiple Schedule List", "Multiple Schedule List") self.viewScheduleID = wx.NewId() mnu_scheduleList = menu_view.Append(self.viewScheduleID, "&Schedule List", "Schedule List") menu_help = wx.Menu() mnu_help = menu_help.Append(wx.ID_HELP, "&Help", "Help") self._hyper3 = hl.HyperLinkCtrl(self, wx.ID_ANY, "", URL="") self._hyper4 = hl.HyperLinkCtrl(self, wx.ID_ANY, "", URL="") hideBox = wx.BoxSizer(wx.VERTICAL) hideBox.Add(self._hyper3) hideBox.Add(self._hyper4) outBox = wx.BoxSizer(wx.VERTICAL) outBox.Add(hideBox) outBox.Hide(hideBox) self.SetSizer(outBox) mnu_issueList = menu_help.Append(-1, "&Issue List", "Issue List") mnu_about = menu_help.Append(wx.ID_ABOUT, "&About", "About") menubar = wx.MenuBar() menubar.Append(menu_file, "&File") #menubar.Append(menu_settings, "&Settings") menubar.Append(menu_view, "&View") menubar.Append(menu_help, "&Help") self.Bind(wx.EVT_MENU, self.OnLink, mnu_help) self.Bind(wx.EVT_MENU, self.onIssueList, mnu_issueList) self.Bind(wx.EVT_MENU, self.onScheduleList, mnu_scheduleList) self.Bind(wx.EVT_MENU, self.onAbout, mnu_about) self.Bind(wx.EVT_MENU, self.onExit, mnu_exit) self.Bind(wx.EVT_MENU, self.onNew, mnu_new) self.Bind(wx.EVT_MENU, self.onOpen, mnu_open) self.Bind(wx.EVT_MENU, self.onMulti, mnu_multi) self.SetMenuBar(menubar)
def __init__(self, parent): wx.Dialog.__init__(self, parent, -1, _("About Word Up!"), style=wx.DEFAULT_DIALOG_STYLE) version = parent.VERSION title = wx.StaticText(self, -1, "Word Up!") title.SetFont(wx.Font(18, wx.DEFAULT, wx.NORMAL, wx.BOLD)) sz = wx.BoxSizer(wx.VERTICAL) sz.Add((15, 15)) sz.Add(title, 0, wx.ALIGN_CENTRE | wx.ALL, 5) sz.Add(wx.StaticText(self, -1, "Version %s" % version), 0, wx.ALIGN_CENTRE | wx.ALL, 5) sz.Add( hl.HyperLinkCtrl(self, -1, "Marc Abramowitz", URL="http://marc-abramowitz.com/"), 0, wx.ALIGN_CENTRE | wx.ALL, 5) sz.Add( hl.HyperLinkCtrl(self, -1, "Word Up! Web", URL="http://marc-abramowitz.com/word_up"), 0, wx.ALIGN_CENTRE | wx.ALL, 5) if parent.FREE_EDITION: sz.Add( hl.HyperLinkCtrl( self, -1, "Buy Word Up! Premium Edition", URL="http://marc-abramowitz.com/word_up/upgrade.php"), 0, wx.ALIGN_CENTRE | wx.ALL, 5) sz.Add((15, 15)) sz.Add(wx.StaticLine(self, -1, style=wx.LI_HORIZONTAL), 0, wx.ALIGN_CENTRE | wx.ALL | wx.EXPAND, 5) sz.Add((5, 5)) okButton = wx.Button(self, wx.ID_OK) okButton.SetDefault() sz.Add(okButton, 0, wx.ALIGN_RIGHT | wx.RIGHT | wx.BOTTOM, 20) self.SetSizer(sz) self.SetAutoLayout(True) sz.SetMinSize((300, -1)) sz.Fit(self) self.CentreOnParent(wx.BOTH)
def __init__(self, *args, **kwargs): super(Frame, self).__init__(*args, **kwargs) self.MyFrame = self self.is_running = False self.panel = wx.Panel(self, pos=(0, 0), size=(500, 100), style=wx.CLOSE_BOX | wx.CAPTION | wx.MINIMIZE_BOX | wx.SYSTEM_MENU) self.panel.SetBackgroundColour('#ffffff') self.SetTitle('Filmow to Letterboxd') self.SetMinSize((500, 300)) self.SetMaxSize((500, 300)) self.letterboxd_link = hl.HyperLinkCtrl( self.panel, -1, 'letterboxd', URL='https://letterboxd.com/import/', pos=(420, 240)) self.letterboxd_link.SetToolTip( wx.ToolTip( 'Clica só quando o programa tiver rodado e sua conta no Letterboxd tiver criada, beleza?' )) self.coffee_link = hl.HyperLinkCtrl( self.panel, -1, 'quer me agradecer?', URL='https://www.buymeacoffee.com/yanari', pos=(310, 240)) self.coffee_link.SetToolTip( wx.ToolTip( 'Se tiver dado tudo certo cê pode me pagar um cafézinho, que tal?. Não é obrigatório, claro.' )) wx.StaticText(self.panel, -1, 'Username no Filmow:', pos=(25, 54)) self.username = wx.TextCtrl(self.panel, size=(200, 25), pos=(150, 50)) submit_button = wx.Button(self.panel, wx.ID_SAVE, 'Submit', pos=(360, 50)) self.Bind(wx.EVT_BUTTON, self.Submit, submit_button) self.Bind(wx.EVT_CLOSE, self.OnClose) self.Show(True)
def LoadProject(self, proj_name="Unnamed", proj_dir=""): """ Load into user interface name of invesalius.project into import task panel. Can be called 3 times in sequence. Call UnloadProjects to empty it. """ # TODO: What todo when it is called more than 3 times? # TODO: Load from config file last 3 recent projects proj_path = os.path.join(proj_dir, proj_name) if (self.proj_count < 3): self.proj_count += 1 # Create name to be plot on GUI label = " " + str(self.proj_count) + ". " + proj_name # Create corresponding hyperlink proj_link = hl.HyperLinkCtrl(self, -1, label) proj_link.SetUnderlines(False, False, False) proj_link.SetColours("BLACK", "BLACK", "BLACK") proj_link.SetBackgroundColour(self.GetBackgroundColour()) proj_link.AutoBrowse(False) proj_link.UpdateLink() proj_link.Bind(hl.EVT_HYPERLINK_LEFT, lambda e: self.OpenProject(proj_path)) # Add to existing frame self.sizer.Add(proj_link, 1, wx.GROW | wx.EXPAND | wx.ALL, 2) self.Update() # Add hyperlink to floating hyperlinks list self.float_hyper_list.append(proj_link)
def __init__(self, parent): wx.Panel.__init__(self, parent) version_label = wx.StaticText(self, -1, "FFXIV Backup Manager v1.0") sourcecode_label = hl.HyperLinkCtrl(self, -1, "View source code at Github", URL="https://github.com/znzinc01/FFXIV-BackupManager") twitter_label = hl.HyperLinkCtrl(self, -1, "Contact developer with Twitter", URL="https://twitter.com/znzinc01") sizer = wx.FlexGridSizer(cols=2, hgap=6, vgap=6) sizer.AddMany([ version_label, wx.StaticText(self), sourcecode_label, wx.StaticText(self), twitter_label, wx.StaticText(self) ]) self.SetSizer(sizer)
def __init__(self, *args, **kwargs): super(ContributeDialog, self).__init__(title="Contribute to PyCorrFit", *args, **kwargs) pane = self.GetContentsPane() pane_btns = sized_controls.SizedPanel(pane) pane_btns.SetSizerType('vertical') pane_btns.SetSizerProps(align="center") wx.StaticText(pane_btns, label=contribute_text) wx.StaticText(pane_btns, label="\nLinks:") for ii, link in enumerate(contribute_links): hl.HyperLinkCtrl(pane_btns, -1, "[{}] {}".format(ii + 1, link), URL=link) wx.StaticText(pane_btns, label="\n") button_ok = wx.Button(pane_btns, label='OK') button_ok.Bind(wx.EVT_BUTTON, self.on_button) button_ok.SetFocus() button_ok.SetSizerProps(expand=True) self.Fit()
def __init__(self, parent): wx.Panel.__init__(self, parent) box_sizer = wx.BoxSizer(wx.VERTICAL) top_sizer = wx.BoxSizer(wx.HORIZONTAL) left_sizer = wx.BoxSizer(wx.VERTICAL) left_sizer.Add( wx.StaticText(self, label=_("Set User Defined Environment Variable:")), 0, wx.TOP | wx.EXPAND, SPACE) self.dvlc = dataview.DataViewListCtrl(self, size=(510, 230)) self.dvlc.AppendTextColumn(_('Key'), width=100) self.dvlc.AppendTextColumn(_('Value'), width=410) dataview.EVT_DATAVIEW_SELECTION_CHANGED(self.dvlc, -1, self.UpdateUI) left_sizer.Add(self.dvlc, 1, wx.TOP | wx.RIGHT | wx.EXPAND, HALF_SPACE) top_sizer.Add(left_sizer, 0, wx.LEFT, 0) right_sizer = wx.BoxSizer(wx.VERTICAL) self.new_btn = wx.Button(self, -1, _("New..")) wx.EVT_BUTTON(self.new_btn, -1, self.NewVariable) right_sizer.Add(self.new_btn, 0, wx.LEFT | wx.BOTTOM | wx.EXPAND, SPACE) self.edit_btn = wx.Button(self, -1, _("Edit")) wx.EVT_BUTTON(self.edit_btn, -1, self.EditVariable) right_sizer.Add(self.edit_btn, 0, wx.LEFT | wx.BOTTOM | wx.EXPAND, SPACE) self.remove_btn = wx.Button(self, -1, _("Remove...")) wx.EVT_BUTTON(self.remove_btn, -1, self.RemoveVariable) right_sizer.Add(self.remove_btn, 0, wx.LEFT | wx.BOTTOM | wx.EXPAND, SPACE) top_sizer.Add(right_sizer, 0, wx.TOP, SPACE * 3.5) bottom_sizer = wx.BoxSizer(wx.HORIZONTAL) self._includeCheckBox = wx.CheckBox( self, -1, _("Include System Environment Variable")) self.Bind(wx.EVT_CHECKBOX, self.checkInclude, self._includeCheckBox) bottom_sizer.Add(self._includeCheckBox, 0, wx.LEFT | wx.ALIGN_BOTTOM) self.hyperLinkCtrl = hl.HyperLinkCtrl(self, wx.ID_ANY, _("View")) self.hyperLinkCtrl.SetColours("BLUE", "BLUE", "BLUE") self.hyperLinkCtrl.AutoBrowse(False) self.hyperLinkCtrl.SetBold(True) self.Bind(hl.EVT_HYPERLINK_LEFT, self.OnGotoLink, self.hyperLinkCtrl) bottom_sizer.Add(self.hyperLinkCtrl, 0, wx.LEFT | wx.ALIGN_BOTTOM, SPACE) box_sizer.Add(top_sizer, 0, wx.TOP, HALF_SPACE) box_sizer.Add(bottom_sizer, 0, wx.TOP, SPACE) self.SetSizer(box_sizer) self.interpreter = None self.UpdateUI(None)
def CreateHyperLink(self, parent, name, link): 'Permite la creaci? de un Hipervinculo.' self.hyper = hl.HyperLinkCtrl(parent, -1, name, pos=(100, 100), URL=link) return self.hyper
def __init__(self, parent): wx.Panel.__init__(self, parent) default_colour = self.GetBackgroundColour() backgroud_colour = wx.Colour(255,255,255) self.SetBackgroundColour(backgroud_colour) self.SetAutoLayout(1) BMP_ADD = wx.Bitmap(os.path.join(inv_paths.ICON_DIR, "object_add.png"), wx.BITMAP_TYPE_PNG) #BMP_ADD.SetWidth(25) #BMP_ADD.SetHeight(25) # Button for creating new surface button_new_surface = pbtn.PlateButton(self, BTN_NEW, "", BMP_ADD, style=\ pbtn.PB_STYLE_SQUARE | pbtn.PB_STYLE_DEFAULT) button_new_surface.SetBackgroundColour(self.GetBackgroundColour()) self.Bind(wx.EVT_BUTTON, self.OnButton) # Fixed hyperlink items tooltip = wx.ToolTip(_("Create 3D surface based on a mask")) link_new_surface = hl.HyperLinkCtrl(self, -1, _("Create new 3D surface")) link_new_surface.SetUnderlines(False, False, False) link_new_surface.SetBold(True) link_new_surface.SetColours("BLACK", "BLACK", "BLACK") link_new_surface.SetBackgroundColour(self.GetBackgroundColour()) link_new_surface.SetToolTip(tooltip) link_new_surface.AutoBrowse(False) link_new_surface.UpdateLink() link_new_surface.Bind(hl.EVT_HYPERLINK_LEFT, self.OnLinkNewSurface) Publisher.subscribe(self.OnLinkNewSurface, 'Open create surface dialog') # Create horizontal sizers to represent lines in the panel line_new = wx.BoxSizer(wx.HORIZONTAL) line_new.Add(link_new_surface, 1, wx.EXPAND|wx.GROW| wx.TOP|wx.RIGHT, 4) line_new.Add(button_new_surface, 0, wx.ALL|wx.EXPAND|wx.GROW, 0) # Folde panel which contains surface properties and quality fold_panel = FoldPanel(self) fold_panel.SetBackgroundColour(default_colour) # Button to fold to select region task button_next = wx.Button(self, -1, _("Next step")) if sys.platform != 'win32': button_next.SetWindowVariant(wx.WINDOW_VARIANT_SMALL) button_next.Bind(wx.EVT_BUTTON, self.OnButtonNextTask) # Add line sizers into main sizer main_sizer = wx.BoxSizer(wx.VERTICAL) main_sizer.Add(line_new, 0,wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5) main_sizer.Add(fold_panel, 0, wx.GROW|wx.EXPAND|wx.ALL, 5) main_sizer.Add(button_next, 0, wx.ALIGN_RIGHT|wx.RIGHT|wx.BOTTOM, 5) main_sizer.Fit(self) self.SetSizerAndFit(main_sizer) self.Update() #self.SetAutoLayout(1) self.sizer = main_sizer
def createWidgets(self): p = self.panel font = wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD) self.fromLbl = wx.StaticText(p, wx.NewIdRef(), _('From:'), size=(70, -1)) self.fromTxt = wx.TextCtrl(p, wx.NewIdRef(), self.email) self.toLbl = wx.StaticText(p, wx.NewIdRef(), _('To:'), size=(70, -1)) self.toTxt = wx.TextCtrl(p, wx.NewIdRef(), '*****@*****.**') self.subjectLbl = wx.StaticText(p, wx.NewIdRef(), _('Subject:'), size=(70, -1)) self.subjectTxt = wx.TextCtrl(p, wx.NewIdRef(), '') self.attachBtn = wx.Button(p, wx.NewIdRef(), _('Attachments')) self.attachTxt = wx.TextCtrl(p, wx.NewIdRef(), '', style=wx.TE_MULTILINE) self.attachTxt.Disable() self.editAttachBtn = wx.Button(p, wx.NewIdRef(), _('Edit Attachments')) self.messageTxt = wx.TextCtrl(p, wx.NewIdRef(), '', style=wx.TE_MULTILINE) # Web link with underline rollovers, opens in same window self.url = hl.HyperLinkCtrl( self.panel, -1, "Allow the access to Google for your less secure app", pos=(100, 150), URL="https://myaccount.google.com/lesssecureapps?pli=1") self.url.AutoBrowse(True) self.url.SetColours("BLUE", "BLUE", "BLUE") self.url.EnableRollover(True) self.url.SetUnderlines(False, False, True) self.url.SetBold(True) #self.url.OpenInSameWindow(True) self.url.SetToolTip( wx.ToolTip( "In a nutshell, google is not allowing you to log in via smtplib because it has flagged this sort of login as 'less secure', so what you have to do is go to this link while you're logged in to your google account, and allow the access" )) self.url.UpdateLink() self.Bind(wx.EVT_BUTTON, self.onAttach, self.attachBtn) self.Bind(wx.EVT_BUTTON, self.onAttachEdit, self.editAttachBtn) self.fromLbl.SetFont(font) self.toLbl.SetFont(font) self.subjectLbl.SetFont(font)
def __init__(self, parent, link): super(UrlDialog, self).__init__(parent = parent, title = "Visit website", size = wx.Size(900, 100)) self.SetMaxSize(wx.Size(900, 100)) sizer = wx.BoxSizer(wx.HORIZONTAL) hyperlink = hl.HyperLinkCtrl(self, -1, label = link, pos = wx.DefaultPosition, URL = link) sizer.SetMinSize(-1, -1) sizer.Add(hyperlink, 0, wx.ALL, 5) self.SetSizer(sizer) self.Show()
def __init__(self,latest,runningVersion): wx.Dialog.__init__(self,None,-1,title='PsychoPy2 Updates') sizer=wx.BoxSizer(wx.VERTICAL) #info about current version msg1 = wx.StaticText(self,-1,style=wx.ALIGN_CENTRE, label=_translate("PsychoPy v%(latest)s is available (you are running %(running)s).\n\n(To disable this check, see Preferences > connections > checkForUpdates)") % {'latest':latest['version'],'running':runningVersion}) if latest['lastCompatible']>runningVersion: msg2 = wx.StaticText(self,-1,style=wx.ALIGN_CENTRE, label=_translate("This version MAY require you to modify your\nscripts/exps slightly. Read the changelog carefully.")) msg2.SetForegroundColour([200,0,0]) else: msg2 = wx.StaticText(self,-1,style=wx.ALIGN_CENTRE, label=_translate("There are no known compatibility\nissues with your current version.")) changelogLink = wxhl.HyperLinkCtrl(self, wx.ID_ANY, _translate("View complete Changelog"), URL="http://www.psychopy.org/changelog.html") if sys.platform.startswith('linux'): msg3 = wx.StaticText(self,-1,_translate("You can update PsychoPy with your package manager")) else: msg3 = wx.StaticText(self,-1,_translate("Should PsychoPy update itself?")) sizer.Add(msg1,flag=wx.ALL|wx.CENTER,border=15) sizer.Add(msg2,flag=wx.RIGHT|wx.LEFT|wx.CENTER,border=15) sizer.Add(changelogLink,flag=wx.RIGHT|wx.LEFT|wx.CENTER,border=5) sizer.Add(msg3,flag=wx.ALL|wx.CENTER,border=15) #add buttons btnSizer=wx.BoxSizer(wx.HORIZONTAL) if sys.platform.startswith('linux'):#for linux there should be no 'update' option self.cancelBtn=wx.Button(self,wx.ID_CANCEL,_translate('Keep warning me')) self.cancelBtn.SetDefault() self.noBtn=wx.Button(self,wx.ID_NO,_translate('Stop warning me')) else: self.yesBtn=wx.Button(self,wx.ID_YES,_translate('Yes')) self.Bind(wx.EVT_BUTTON, self.onButton, id=wx.ID_YES) self.cancelBtn=wx.Button(self,wx.ID_CANCEL,_translate('Not now')) self.noBtn=wx.Button(self,wx.ID_NO,_translate('Skip this version')) self.Bind(wx.EVT_BUTTON, self.onButton, id=wx.ID_CANCEL) self.Bind(wx.EVT_BUTTON, self.onButton, id=wx.ID_NO) btnSizer.Add(self.noBtn, wx.ALIGN_LEFT) btnSizer.Add((60, 20), 0, wx.EXPAND) btnSizer.Add(self.cancelBtn, wx.ALIGN_RIGHT) if not sys.platform.startswith('linux'): self.yesBtn.SetDefault() btnSizer.Add((5, 20), 0) btnSizer.Add(self.yesBtn, wx.ALIGN_RIGHT) #configure sizers and fit sizer.Add(btnSizer,flag=wx.ALIGN_RIGHT|wx.ALL,border=5) self.Center() self.SetSizerAndFit(sizer)
def __init__(self, parent, version): MySizedDialog.__init__(self, None, -1, _('Update'), style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) self.parent = parent panel = self.GetContentsPane() panel.SetSizerType("vertical") wx.StaticText(panel, -1, _('Found new version:') + ' YouMoney-%s' % version) hl.HyperLinkCtrl(panel, wx.ID_ANY, _("Open download page"), URL="http://code.google.com/p/youmoney/") #TODO:need update wx.StaticText(panel, -1, _('Click OK to start the automatic update.')) self.SetButtonSizer(self.CreateStdDialogButtonSizer(wx.OK | wx.CANCEL)) self.SetMinSize(wx.Size(300, 170)) self.Fit()
def Build_Hyperlink(self) : """ Construit un hyperlien """ self.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL, False)) hyper = hl.HyperLinkCtrl(self.panel_base, -1, _(u"Sélectionner uniquement les déplacements non-remboursés"), URL="") hyper.Bind(hl.EVT_HYPERLINK_LEFT, self.OnLeftLink) hyper.AutoBrowse(False) hyper.SetColours("BLACK", "BLACK", "BLUE") hyper.EnableRollover(True) hyper.SetUnderlines(False, False, True) hyper.SetBold(False) hyper.SetToolTip(wx.ToolTip(_(u"Cliquez ici pour sélectionner uniquement \nles déplacements non-remboursés"))) hyper.UpdateLink() hyper.DoPopup(False) return hyper
def Build_Hyperlink(self) : """ Construit un hyperlien """ self.SetFont(wx.Font(8, wx.SWISS, wx.NORMAL, wx.NORMAL, False)) hyper = hl.HyperLinkCtrl(self, -1, _(u"(Détails)"), URL="") hyper.Bind(hl.EVT_HYPERLINK_LEFT, self.OnLeftLink) hyper.AutoBrowse(False) hyper.SetColours("BLUE", "BLUE", "BLUE") hyper.EnableRollover(True) hyper.SetUnderlines(False, False, True) hyper.SetBold(False) hyper.SetToolTip(wx.ToolTip(_(u"Cliquez ici pour sélectionner les données à importer"))) hyper.UpdateLink() hyper.DoPopup(False) return hyper
def Build_Hyperlink_reduire(self): """ Construit un hyperlien """ self.SetFont(wx.Font(8, wx.SWISS, wx.NORMAL, wx.NORMAL, False)) hyper = hl.HyperLinkCtrl(self, -1, _(u"Tout réduire"), URL="") hyper.Bind(hl.EVT_HYPERLINK_LEFT, self.OnLeftLink_reduire) hyper.AutoBrowse(False) hyper.SetColours("BLUE", "BLUE", "BLUE") hyper.EnableRollover(True) hyper.SetUnderlines(False, False, True) hyper.SetBold(False) hyper.SetToolTip(wx.ToolTip(_(u"Tout réduire"))) hyper.UpdateLink() hyper.DoPopup(False) return hyper
def Build_Hyperlink(self) : """ Construit un hyperlien """ self.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL, False)) hyper = hl.HyperLinkCtrl(self.panel_base, -1, _(u"Réinitialiser les paramètres par défaut"), URL="") hyper.Bind(hl.EVT_HYPERLINK_LEFT, self.OnLeftLink) hyper.AutoBrowse(False) hyper.SetColours("BLACK", "BLACK", "BLUE") hyper.EnableRollover(True) hyper.SetUnderlines(True, True, True) hyper.SetBold(False) hyper.SetToolTip(wx.ToolTip(_(u"Cliquez ici pour réinitialiser les paramètres par défaut de ce gadget"))) hyper.UpdateLink() hyper.DoPopup(False) return hyper
def OnSearch(self, event): matchlist = cf.top_match(cf, loadDict() , '사용자') ch = 0 gap = -20 fr = wx.Frame(parent=None, title="음식 추천 순위", size=(320, 200)) fr.pnl = wx.Panel(fr) for m in matchlist: gap += 20 ch += 1 hl.HyperLinkCtrl(fr.pnl, -1, m[1], pos=(30, 20 + gap), URL=findURL(m[1])) fr.Centre() fr.Show(True)
def __init__(self, parent): super(SubscriptionPanel, self).__init__(parent) self.sizer = wx.BoxSizer(wx.VERTICAL) label = ( 'To use the service, you need to ensure that you have right ' 'subscription key.\nPlease note that each service (Face, Emotion, ' 'Speech, etc) has its own subscription key.\nIf you do not have ' 'key yet, please use the link to get a key first, then paste the ' 'key into the textbox below.') style = wx.ALIGN_LEFT | wx.ST_ELLIPSIZE_END self.static_text = wx.StaticText(self, label=label, style=style) self.sizer.Add(self.static_text, flag=wx.EXPAND | wx.ALL, border=5) label = 'Get Key' url = 'https://www.microsoft.com/cognitive-services/en-us/sign-up' colour_window = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW) flag = wx.ALIGN_LEFT | wx.ALL self.link = HL.HyperLinkCtrl(self, label=label, URL=url) self.link.SetBackgroundColour(colour_window) self.sizer.Add(self.link, flag=flag, border=5) subsizer = wx.BoxSizer() flag = wx.ALIGN_CENTER_VERTICAL | wx.ALL self.label = wx.StaticText(self, label='Subscription Key : ') subsizer.Add(self.label, flag=flag, border=5) flag = wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALL self.text = wx.TextCtrl(self, size=(-1, -1)) self.text.SetValue(util.SubscriptionKey.get().decode('utf-8')) subsizer.Add(self.text, 1, flag=flag, border=5) flag = wx.ALIGN_CENTER_VERTICAL | wx.ALL self.btn_save = wx.Button(self, label='Save Key') subsizer.Add(self.btn_save, flag=flag, border=5) self.Bind(wx.EVT_BUTTON, self.OnSaveKey, self.btn_save) flag = wx.ALIGN_CENTER_VERTICAL | wx.ALL self.btn_del = wx.Button(self, label='Delete Key') subsizer.Add(self.btn_del, flag=flag, border=5) self.Bind(wx.EVT_BUTTON, self.OnDeleteKey, self.btn_del) flag = wx.EXPAND | wx.TOP | wx.BOTTOM self.sizer.Add(subsizer, flag=flag, border=5) self.SetSizer(self.sizer)
def __init__(self, parent, label): super(self.__class__, self).__init__(parent) vbox = wx.BoxSizer(wx.VERTICAL) self.SetSizer(vbox) self.link = hl.HyperLinkCtrl(self, label=label, URL="") self.link.EnableRollover(True) vbox.Add(self.link, proportion=0, flag=wx.ALL, border=SPACING) vbox.Add( wx.StaticLine(self, size=(10000, 2), style=wx.LI_HORIZONTAL), proportion=0, flag=wx.ALL | wx.EXPAND, border=SPACING / 2, )
def OnHelp(self, event): event_id = event.GetId() l = hl.HyperLinkCtrl(self, -1) l.Show(False) # Do not display the hyperlink control if event_id == wx.ID_ABOUT: about = About(self) about.show() elif event_id == ID_Help: l.GotoURL("http://synfig.org/wiki/Category:Manual") elif event_id == ID_HelpTutorials: l.GotoURL("http://synfig.org/wiki/Category:Tutorials") elif event_id == ID_HelpReference: l.GotoURL("http://synfig.org/wiki/Category:Reference") elif event_id == ID_HelpFAQ: l.GotoURL("http://synfig.org/wiki/FAQ") elif event_id == ID_HelpSupport: l.GotoURL("http://synfig.org/cms/en/support")
def initUI(self): '''Init of user interface''' pos = [(0, 0), (0, 1), (1, 0), (1, 1), (2, 0), (3, 0), (5, 0), (6, 0)] spans = [(1, 2), (2, 2)] defaults = dict(flag=wx.EXPAND | wx.ALL, border=5) self.panel = wx.Panel(self) box = wx.GridBagSizer() static = wx.StaticText(self.panel, label='Regione', style=wx.LEFT) box.Add(static, pos[0], **defaults) self.regions = wx.Choice(self.panel, choices=list(self.italy.keys())) self.regions.SetToolTip( 'premi i per i dati di tutta Italia, d per default') box.Add(self.regions, pos[1], **defaults) static = wx.StaticText(self.panel, label='Provincia', style=wx.ALIGN_LEFT) box.Add(static, pos[2], **defaults) self.cities = wx.Choice(self.panel) self.cities.SetToolTip('premi f per cercare una provincia') box.Add(self.cities, pos[3], **defaults) self.result = wx.StaticText(self.panel, style=wx.ALIGN_CENTER) self.result.SetToolTip( 'premi r per aggiornare le statistiche, c per copiarne il contenuto' ) box.Add(self.result, pos[4], spans[0], **defaults) self.graph = wx.StaticBitmap(self.panel, style=wx.ALIGN_CENTER) self.graph.SetToolTip('premi r per aggiornare le statistiche') box.Add(self.graph, pos[5], spans[1], **defaults) lnk = hl.HyperLinkCtrl(parent=self.panel, label='fonte: ' + self.stats.baseUrl, URL=self.stats.url) box.Add(lnk, pos[6], spans[0], **defaults) about = wx.StaticText(self.panel, style=wx.ALIGN_CENTER, label='Made by sdutz') about.SetToolTip('premi q per uscire') box.Add(about, pos[7], spans[0], **defaults) self.regions.Bind(wx.EVT_CHOICE, self.OnRegions) self.cities.Bind(wx.EVT_CHOICE, self.OnCities) self.Bind(wx.EVT_CLOSE, self.onClose) self.panel.Bind(wx.EVT_CHAR, self.onKeyDown) self.panel.SetSizerAndFit(box)
def __init__(self, tbody, *args, **kw): super(NCBox, self).__init__(*args, **kw) parentBX = wx.BoxSizer(wx.VERTICAL) self.hpl = hl.HyperLinkCtrl(self, -1, "NCIC", URL="https://nghichcode.com/") self.stxt = wx.StaticText(self, wx.ID_ANY, tbody) parentBX.Add(self.stxt, 0, wx.ALL, 5) parentBX.Add(self.hpl, 0, wx.ALL, 5) self.SetSizer(parentBX) self.Layout() parentBX.Fit(self) self.Centre(wx.BOTH) self.Bind(wx.EVT_CLOSE, self.on_exit)
def __pasar_a_html(self, editor): '''Parseo de código Python para pasarlo a HTML''' # Creamos fichero temporal con el código del editor. f = codecs.open(self.__fich_imp, 'w', 'utf-8') f.write(editor.GetText()) f.close() # Creamos fichero html con código Python. html = py_to_html(self.__fich_imp, self.__fich_html, idioma=self.l) html.cargar_fichero() ret, msj = html.crear_fichero_html() if not ret: wx.MessageBox(msj, t(u"Atención", self.l), wx.OK) return # Lanzamos la pagina web en el navegador por defecto. lanzadera_web = enlace_web.HyperLinkCtrl(self, -1) lanzadera_web.Show(False) lanzadera_web.GotoURL(os.path.realpath(self.__fich_html), True, False) # Nos limpiamos el objeto lanzadera. lanzadera_web.Destroy()
def test_lib_agw_hyperlinkMethods(self): url = 'http://www.wxpython.org/' link = HL.HyperLinkCtrl(self.frame, -1, 'wxPython Main Page', pos=(100, 100), URL=url) link.AutoBrowse(False) link.SetColours('RED', 'GREEN', 'BLUE') link.EnableRollover(True) link.SetUnderlines(False, False, True) link.SetBold(True) link.OpenInSameWindow(True) link.SetToolTip(wx.ToolTip('Hello World!')) link.UpdateLink() self.assertTrue(link.GetColours(), ('RED', 'GREEN', 'BLUE')) self.assertTrue(not link.GetUnderlines()[0]) self.assertTrue(not link.GetVisited()) self.assertEqual(link.GetURL(), url)
def __init__(self, *args, **kw): super(LocationPicker, self).__init__(*args, **kw) global CAPTURE_ERRORS if CAPTURE_ERRORS: sys.excepthook = handleexception self.pnl = wx.Panel(self) st = wx.StaticText(self.pnl, label="Steam installation:") self.steamLocation = wx.DirPickerCtrl( self.pnl, path="C:\\Program Files (x86)\\Steam") egst = wx.StaticText(self.pnl, label="Epic Games Store installation:") self.egsLocation = wx.DirPickerCtrl( self.pnl, path="C:\\ProgramData\\Epic\\EpicGamesLauncher") nextButton = wx.Button(self.pnl, label="Next") nextButton.Bind(wx.EVT_BUTTON, self.next) sizer = wx.BoxSizer(wx.VERTICAL) flags = wx.EXPAND sizer.AddSpacer(15) sizer.Add(st, 0, flags) sizer.Add(self.steamLocation, 0, flags) sizer.AddSpacer(15) sizer.Add(egst, 0, flags) sizer.Add(self.egsLocation, 0, flags) sizer.AddSpacer(15) sizer.Add(nextButton, 0, flags) sizer.AddSpacer(15) sizer.Add( hl.HyperLinkCtrl( self.pnl, label="steamsync by Jayden Milne", URL="https://github.com/jaydenmilne/steamsync", ), 0, ) sizer.AddSpacer(15) self.pnl.SetSizer(sizer)