def __init__(self, exception=None, tb=None, error_title='Error!'): v = sys.version_info wx.Frame.__init__(self, None, id=wx.ID_ANY, title="pyfa error", pos=wx.DefaultPosition, size=wx.Size(500, 600), style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER | wx.STAY_ON_TOP) desc = "pyfa has experienced an unexpected issue. Below is a message that contains crucial\n" \ "information about how this was triggered. Please contact the developers with the\n" \ "information provided through the EVE Online forums or file a GitHub issue." self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) if 'wxMSW' in wx.PlatformInfo: self.SetBackgroundColour( wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE)) mainSizer = wx.BoxSizer(wx.VERTICAL) headSizer = wx.BoxSizer(wx.HORIZONTAL) headingText = wx.StaticText(self, wx.ID_ANY, error_title, wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE) headingText.SetFont(wx.Font(14, 74, 90, 92, False)) headSizer.Add(headingText, 1, wx.ALL, 5) mainSizer.Add(headSizer, 0, wx.EXPAND, 5) mainSizer.Add( wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL), 0, wx.EXPAND | wx.ALL, 5) box = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(box, 0, wx.EXPAND | wx.ALIGN_TOP) descText = wx.StaticText(self, wx.ID_ANY, desc) box.Add(descText, 1, wx.ALL, 5) github = wx.HyperlinkCtrl(self, wx.ID_ANY, "Github", "https://github.com/pyfa-org/Pyfa/issues", wx.DefaultPosition, wx.DefaultSize, wx.HL_DEFAULT_STYLE) box.Add(github, 0, wx.ALL, 5) eveForums = wx.HyperlinkCtrl( self, wx.ID_ANY, "EVE Forums", "https://forums.eveonline.com/default.aspx?g=posts&t=466425", wx.DefaultPosition, wx.DefaultSize, wx.HL_DEFAULT_STYLE) box.Add(eveForums, 0, wx.ALL, 5) # mainSizer.AddSpacer((0, 5), 0, wx.EXPAND, 5) errorTextCtrl = wx.TextCtrl( self, wx.ID_ANY, "", wx.DefaultPosition, (-1, 400), wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH2 | wx.TE_DONTWRAP) errorTextCtrl.SetFont( wx.Font(8, wx.FONTFAMILY_TELETYPE, wx.NORMAL, wx.NORMAL)) mainSizer.Add(errorTextCtrl, 0, wx.EXPAND | wx.ALL | wx.ALIGN_CENTER, 5) try: errorTextCtrl.AppendText("OS version: \t" + str(platform.platform())) except: errorTextCtrl.AppendText("OS version: Unknown") errorTextCtrl.AppendText("\n") try: errorTextCtrl.AppendText( "Python: \t" + '{}.{}.{}'.format(v.major, v.minor, v.micro)) except: errorTextCtrl.AppendText("Python: Unknown") errorTextCtrl.AppendText("\n") try: errorTextCtrl.AppendText("wxPython: \t" + wx.VERSION_STRING) except: errorTextCtrl.AppendText("wxPython: Unknown") errorTextCtrl.AppendText("\n") errorTextCtrl.AppendText("SQLAlchemy: \t" + str(sqlalchemy_version)) errorTextCtrl.AppendText("\n") errorTextCtrl.AppendText("Logbook: \t" + str(logbook_version)) errorTextCtrl.AppendText("\n") try: errorTextCtrl.AppendText("pyfa version: {0} {1} - {2} {3}".format( config.version, config.tag, config.expansionName, config.expansionVersion)) except: errorTextCtrl.AppendText("pyfa version: Unknown") errorTextCtrl.AppendText('\n') errorTextCtrl.AppendText("pyfa root: " + str(config.pyfaPath or "Unknown")) errorTextCtrl.AppendText('\n') errorTextCtrl.AppendText("save path: " + str(config.savePath or "Unknown")) errorTextCtrl.AppendText('\n') errorTextCtrl.AppendText("fs encoding: " + str(sys.getfilesystemencoding() or "Unknown")) errorTextCtrl.AppendText('\n\n') errorTextCtrl.AppendText("EXCEPTION: " + str(exception or "Unknown")) errorTextCtrl.AppendText('\n\n') if tb: for line in tb: errorTextCtrl.AppendText(line) errorTextCtrl.Layout() self.SetSizer(mainSizer) mainSizer.Layout() self.Layout() self.Centre(wx.BOTH) self.Show()
def __init__(self, *args, **kwds): # begin wxGlade: vampire_the_dark_ages.__init__ kwds["style"] = wx.TAB_TRAVERSAL wx.ScrolledWindow.__init__(self, *args, **kwds) self.label_1 = wx.StaticText(self, -1, _("Name:")) self.name = wx.TextCtrl(self, -1, "") self.label_2 = wx.StaticText(self, -1, _("Nature:")) self.nature = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN) self.label_3 = wx.StaticText(self, -1, _("Generation:")) self.generation = wx.SpinCtrl(self, -1, "13", min=1, max=15) self.label_4 = wx.StaticText(self, -1, _("Player:")) self.player = wx.TextCtrl(self, -1, "") self.label_5 = wx.StaticText(self, -1, _("Demeanor:")) self.demeanor = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN) self.label_6 = wx.StaticText(self, -1, _("Haven:")) self.haven = wx.TextCtrl(self, -1, "") self.label_7 = wx.StaticText(self, -1, _("Chronicle:")) self.chronicle = wx.TextCtrl(self, -1, "") self.label_9 = wx.StaticText(self, -1, _("Clan:")) self.clan = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN) self.label_8 = wx.StaticText(self, -1, _("Concept:")) self.concept = wx.TextCtrl(self, -1, "") self.static_line_1 = wx.StaticLine(self, -1) self.label_10 = wx.StaticText(self, -1, _("Attributes")) self.static_line_2 = wx.StaticLine(self, -1) self.label_11 = wx.StaticText(self, -1, _("Physical")) self.label_12 = wx.StaticText(self, -1, _("Social")) self.label_13 = wx.StaticText(self, -1, _("Mental")) self.strength = sfstat(self, -1, label=_("Strength")) self.charisma = sfstat(self, -1, label=_("Charisma")) self.perception = sfstat(self, -1, label=_("Perception")) self.dexterity = sfstat(self, -1, label=_("Dexterity")) self.manipulation = sfstat(self, -1, label=_("Manipulation")) self.intelligence = sfstat(self, -1, label=_("Intelligence")) self.stamina = sfstat(self, -1, label=_("Stamina")) self.appearance = sfstat(self, -1, label=_("Appearance")) self.wits = sfstat(self, -1, label=_("Wits")) self.static_line_3 = wx.StaticLine(self, -1) self.label_14 = wx.StaticText(self, -1, _("Abilities")) self.static_line_4 = wx.StaticLine(self, -1) self.label_15 = wx.StaticText(self, -1, _("Talents")) self.label_16 = wx.StaticText(self, -1, _("Skills")) self.label_17 = wx.StaticText(self, -1, _("Knowledges")) self.acting = sfstat(self, -1, label=_("Acting")) self.alertness = sfstat(self, -1, label=_("Alertness")) self.animalken = sfstat(self, -1, label=_("Animal Ken")) self.academics = sfstat(self, -1, label=_("Academics")) self.athletics = sfstat(self, -1, label=_("Athletics")) self.archery = sfstat(self, -1, label=_("Archery")) self.crafts = sfstat(self, -1, label=_("Crafts")) self.hearth_wisdom = sfstat(self, -1, label=_("Hearth Wisdom")) self.brawl = sfstat(self, -1, label=_("Brawl")) self.dodge = sfstat(self, -1, label=_("Dodge")) self.etiquette = sfstat(self, -1, label=_("Etiquette")) self.investigation = sfstat(self, -1, label=_("Investigation")) self.empathy = sfstat(self, -1, label=_("Empathy")) self.herbalism = sfstat(self, -1, label=_("Herbalism")) self.law = sfstat(self, -1, label=_("Law")) self.melee = sfstat(self, -1, label=_("Melee")) self.linguistics = sfstat(self, -1, label=_("Linguistics")) self.intimidation = sfstat(self, -1, label=_("Intimidation")) self.larceny = sfstat(self, -1, label=_("Larceny")) self.music = sfstat(self, -1, label=_("Music")) self.medicine = sfstat(self, -1, label=_("Medicine")) self.leadership = sfstat(self, -1, label=_("Leadership")) self.ride = sfstat(self, -1, label=_("Ride")) self.occult = sfstat(self, -1, label=_("Occult")) self.stealth = sfstat(self, -1, label=_("Stealth")) self.politics = sfstat(self, -1, label=_("Politics")) self.subterfuge = sfstat(self, -1, label=_("Subterfuge")) self.survival = sfstat(self, -1, label=_("Survival")) self.science = sfstat(self, -1, label=_("Science")) self.seneschal = sfstat(self, -1, label=_("Seneschal")) self.static_line_5 = wx.StaticLine(self, -1) self.label_18 = wx.StaticText(self, -1, _("Advantages")) self.static_line_6 = wx.StaticLine(self, -1) self.label_19 = wx.StaticText(self, -1, _("Backgrounds")) self.label_20 = wx.StaticText(self, -1, _("Disciplines")) self.label_21 = wx.StaticText(self, -1, _("Virtues")) self.background_1_name = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN) self.background_1_level = sfstat(self, -1) self.discipline_1_name = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN) self.discipline_1_level = sfstat(self, -1) self.conscience_conviction_name = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN) self.conscience_conviction_level = sfstat(self, -1) self.background_2_name = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN) self.background_2_level = sfstat(self, -1) self.discipline_2_name = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN) self.discipline_2_level = sfstat(self, -1) self.panel_1 = wx.Panel(self, -1) self.background_3_name = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN) self.background_3_level = sfstat(self, -1) self.discipline_3_name = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN) self.discipline_3_level = sfstat(self, -1) self.panel_2 = wx.Panel(self, -1) self.background_4_name = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN) self.background_4_level = sfstat(self, -1) self.discipline_4_name = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN) self.discipline_4_level = sfstat(self, -1) self.selfcontrol_instinct_name = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN) self.selfcontrol_instinct_level = sfstat(self, -1) self.background_5_name = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN) self.background_5_level = sfstat(self, -1) self.discipline_5_name = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN) self.discipline_5_level = sfstat(self, -1) self.panel_3 = wx.Panel(self, -1) self.background_6_name = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN) self.background_6_level = sfstat(self, -1) self.discipline_6_name = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN) self.discipline_6_level = sfstat(self, -1) self.panel_4 = wx.Panel(self, -1) self.background_7_name = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN) self.background_7_level = sfstat(self, -1) self.discipline_7_name = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN) self.discipline_7_level = sfstat(self, -1) self.courage_name = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN) self.courage_level = sfstat(self, -1) self.static_line_7 = wx.StaticLine(self, -1) self.static_line_8 = wx.StaticLine(self, -1) self.label_22 = wx.StaticText(self, -1, _("Merits")) self.static_line_9 = wx.StaticLine(self, -1) self.merit_1 = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN | wx.CB_SORT) self.merit_2 = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN | wx.CB_SORT) self.merit_3 = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN | wx.CB_SORT) self.static_line_8a = wx.StaticLine(self, -1) self.label_22a = wx.StaticText(self, -1, _("Flaws")) self.static_line_9a = wx.StaticLine(self, -1) self.flaw_1 = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN | wx.CB_SORT) self.flaw_2 = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN | wx.CB_SORT) self.flaw_3 = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN | wx.CB_SORT) self.static_line_10 = wx.StaticLine(self, -1) self.label_23 = wx.StaticText(self, -1, _("Road")) self.static_line_11 = wx.StaticLine(self, -1) self.road_name = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN) self.road_level = sfstat(self, -1, buttons=10) self.static_line_12 = wx.StaticLine(self, -1) self.label_24 = wx.StaticText(self, -1, _("Willpower")) self.static_line_13 = wx.StaticLine(self, -1) self.willpower_max = sfstat(self, -1, buttons=10) self.willpower_current = sfpool(self, -1, rows=1, cols=10) self.static_line_14 = wx.StaticLine(self, -1) self.label_25 = wx.StaticText(self, -1, _("Blood Pool")) self.static_line_15 = wx.StaticLine(self, -1) self.blood_pool = sfpool(self, -1) self.static_line_18 = wx.StaticLine(self, -1) self.label_27 = wx.StaticText(self, -1, _("Health")) self.static_line_19 = wx.StaticLine(self, -1) self.label_28 = wx.StaticText(self, -1, _("Bruised")) self.panel_5 = wx.Panel(self, -1) self.label_29 = wx.StaticText(self, -1, _("Hurt")) self.label_35 = wx.StaticText(self, -1, _("-1")) self.label_30 = wx.StaticText(self, -1, _("Injured")) self.label_36 = wx.StaticText(self, -1, _("-1")) self.label_31 = wx.StaticText(self, -1, _("Wounded")) self.label_37 = wx.StaticText(self, -1, _("-2")) self.label_32 = wx.StaticText(self, -1, _("Mauled")) self.label_38 = wx.StaticText(self, -1, _("-2")) self.label_33 = wx.StaticText(self, -1, _("Crippled")) self.label_39 = wx.StaticText(self, -1, _("-5")) self.label_34 = wx.StaticText(self, -1, _("Incapacitated")) self.panel_6 = wx.Panel(self, -1) self.health = sfhealth(self, -1, buttons=7) self.static_line_16 = wx.StaticLine(self, -1) self.label_26 = wx.StaticText(self, -1, _("Experience")) self.static_line_17 = wx.StaticLine(self, -1) self.experience = wx.SpinCtrl(self, -1, "", min=0, max=100) self.__set_properties() self.__do_layout() # end wxGlade self.initfields()
def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"DDL Creator Wizard", pos=wx.DefaultPosition, size=wx.Size(822, 989), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL) self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) bSizer1 = wx.BoxSizer(wx.VERTICAL) self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, u"Welcome to the Data Definition Language (DDL) creator 1.0", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText3.Wrap(-1) self.m_staticText3.SetFont( wx.Font(15, 70, 90, 92, False, wx.EmptyString)) bSizer1.Add(self.m_staticText3, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) gSizer5 = wx.GridSizer(3, 2, 0, 0) self.m_staticText21 = wx.StaticText( self, wx.ID_ANY, u"Select the XML Database Schema ", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText21.Wrap(-1) self.m_staticText21.SetFont( wx.Font(wx.NORMAL_FONT.GetPointSize(), 70, 90, 92, False, wx.EmptyString)) gSizer5.Add(self.m_staticText21, 0, wx.ALL, 5) self.filePicker_xmlfile = wx.FilePickerCtrl( self, wx.ID_ANY, wx.EmptyString, u"Select a file", u"*.*", wx.DefaultPosition, wx.DefaultSize, wx.FLP_DEFAULT_STYLE) gSizer5.Add(self.filePicker_xmlfile, 0, wx.ALL, 5) self.checkBox_sequentialKeys = wx.CheckBox( self, wx.ID_ANY, u"Create sequential primary keys ?", wx.DefaultPosition, wx.DefaultSize, 0) gSizer5.Add(self.checkBox_sequentialKeys, 0, wx.ALL, 5) self.checkBox_CaseSensitivity = wx.CheckBox( self, wx.ID_ANY, u"Maintain case sensitivity", wx.DefaultPosition, wx.DefaultSize, 0) self.checkBox_CaseSensitivity.SetValue(True) gSizer5.Add(self.checkBox_CaseSensitivity, 0, wx.ALL, 5) self.m_staticText16 = wx.StaticText(self, wx.ID_ANY, u"Global Schema name", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText16.Wrap(-1) gSizer5.Add(self.m_staticText16, 0, wx.ALL, 5) self.textCtrl_GlobalSchema = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) gSizer5.Add(self.textCtrl_GlobalSchema, 0, wx.ALL, 5) self.checkBox_CreateDDLs = wx.CheckBox(self, wx.ID_ANY, u"Create DDL for all Dbs", wx.DefaultPosition, wx.DefaultSize, 0) self.checkBox_CreateDDLs.SetValue(True) gSizer5.Add(self.checkBox_CreateDDLs, 0, wx.ALL, 5) bSizer1.Add(gSizer5, 0, 0, 5) self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, u"Select whic RDBS you want to build the schema for\nEdit a descriptive test to be added on top of the DDL text file to describe your schema", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText5.Wrap(-1) bSizer1.Add(self.m_staticText5, 0, wx.ALL, 5) gSizer7 = wx.GridSizer(0, 2, 0, 0) self.m_staticText10 = wx.StaticText( self, wx.ID_ANY, u"Add your name and possition to print it to the DDL file", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText10.Wrap(-1) gSizer7.Add(self.m_staticText10, 0, wx.ALL, 5) self.textCtrl_UserName = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) gSizer7.Add(self.textCtrl_UserName, 1, wx.ALL, 5) self.m_staticText13 = wx.StaticText(self, wx.ID_ANY, u"Date of generating the file", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText13.Wrap(-1) gSizer7.Add(self.m_staticText13, 0, wx.ALL, 5) self.textCtrl_Date = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) gSizer7.Add(self.textCtrl_Date, 0, wx.ALL, 5) bSizer1.Add(gSizer7, 1, wx.EXPAND, 5) self.m_staticline6 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) bSizer1.Add(self.m_staticline6, 0, wx.EXPAND | wx.ALL, 5) gSizer3 = wx.GridSizer(2, 2, 0, 0) self.checkBox_Sqlite = wx.CheckBox(self, wx.ID_ANY, u"SQLite. Output DDL file name:", wx.DefaultPosition, wx.DefaultSize, 0) self.checkBox_Sqlite.SetValue(True) gSizer3.Add(self.checkBox_Sqlite, 0, wx.ALL, 5) self.textCtrl_SqliteFileName = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) gSizer3.Add(self.textCtrl_SqliteFileName, 1, wx.ALL, 5) self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, u"Description comment inside the DDL file", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText6.Wrap(-1) gSizer3.Add(self.m_staticText6, 0, wx.ALL, 5) self.textCtrl_SQLiteFileDesc = wx.TextCtrl( self, wx.ID_ANY, u"-- This is a Data Definition Language (DDL) script that\n-- generates a blank schema of the Water Management Data Model (WaM-DaM)\n-- for SQLite database\n\n-- Generated\n-- Adel Abdallah \n--May 1, 2017\n-- based on WaM-DaM XML design named --WaMDaMMay1_2017.xml \n--generated by DbWrench V4.03 @ http://www.dbwrench.com\n-- WaMDaM All rights reserved. See Licence @ wamdam.org \n\n--Use the SQLite Manager Add-on to Mozilla Firefox\n--Create a new empty database. Click on the Execute SQL button and delete the text \"SELECT * FROM tablename\"\n--Simply copy all this script and paste into this Execute SQL window\n--Then click Run SQL. The script should run successfully and create the 41 empty tables of WaM-DaM", wx.DefaultPosition, wx.DefaultSize, 0) gSizer3.Add(self.textCtrl_SQLiteFileDesc, 0, wx.ALL | wx.EXPAND, 5) bSizer1.Add(gSizer3, 1, wx.EXPAND, 5) self.m_staticline4 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) bSizer1.Add(self.m_staticline4, 0, wx.EXPAND | wx.ALL, 5) gSizer41 = wx.GridSizer(0, 2, 0, 0) self.m_checkBox3 = wx.CheckBox(self, wx.ID_ANY, u"Postgres. Output DDL file name:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_checkBox3.SetValue(True) gSizer41.Add(self.m_checkBox3, 0, wx.ALL, 5) self.textCtrl_PostgresFileName = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) gSizer41.Add(self.textCtrl_PostgresFileName, 0, wx.ALL, 5) self.m_staticText61 = wx.StaticText( self, wx.ID_ANY, u"Description comment inside the DDL file", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText61.Wrap(-1) gSizer41.Add(self.m_staticText61, 0, wx.ALL, 5) self.textCtrl_PostgresFileDesc = wx.TextCtrl( self, wx.ID_ANY, u"--This is a Data Definition Language (DDL) script that\n--generates a blank schema of the Water Management Data Model (WaMDaM)\n--for PostgreSQL database\n\n-- Generated by \n--Adel Abdallah \n--May1, 2017\n-- based on WaMDaM XML design named --WaMDaMMay1_2017.xml \n--DbWrench V4.0 @ http://www.dbwrench.com\n-- WaMDaM All rights reserved. See Licence @ wamdam.org \n\n--Open PostgreSQL, click on Databases>> Postgers>> at the left Object Browser panel\n--Simply copy all this script and paste into the new window of \"SQL query\"\n--Then click execute. The script should run successfully and create the 41 empty tables of WaM-DaM\"", wx.DefaultPosition, wx.DefaultSize, 0) gSizer41.Add(self.textCtrl_PostgresFileDesc, 0, wx.ALL | wx.EXPAND, 5) bSizer1.Add(gSizer41, 1, wx.EXPAND, 5) self.m_staticline61 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) bSizer1.Add(self.m_staticline61, 0, wx.EXPAND | wx.ALL, 5) gSizer51 = wx.GridSizer(0, 2, 0, 0) self.m_checkBox4 = wx.CheckBox(self, wx.ID_ANY, u"SQL Server. Output DDL file name:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_checkBox4.SetValue(True) gSizer51.Add(self.m_checkBox4, 0, wx.ALL, 5) self.textCtrl_MSSQLFileName = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) gSizer51.Add(self.textCtrl_MSSQLFileName, 0, wx.ALL, 5) self.m_staticText611 = wx.StaticText( self, wx.ID_ANY, u"Description comment inside the DDL file", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText611.Wrap(-1) gSizer51.Add(self.m_staticText611, 0, wx.ALL, 5) self.textCtrl_MSSQLFileDesc = wx.TextCtrl( self, wx.ID_ANY, u"--This is a Data Definition Language (DDL) script that\n--generates a blank schema of the Water Management Data Model (WaMDaM)\n-- for Microsoft SQL Server database.\n\n-- Generated by \n--Adel Abdallah\n--May 1, 2017\n--based on WaMDaM XML design named --WaMDaMMay1_2017.xml\n--generated by DbWrench V4.03 @ http://www.dbwrench.com/\n-- WaMDaM All rights reserved. See Licence @ wamdam.org \n\n-- To create a blank WaM-DaM database in SQL Server,\n-- Open SQL Server, Click File >> New >> Query with Current Condition\n-- Simply copy all this script and paste into the new window of \"create query\"\n-- Then click \"execute\". The script should run successfully and create the 41 empty tables of WaM-DaM", wx.DefaultPosition, wx.DefaultSize, 0) gSizer51.Add(self.textCtrl_MSSQLFileDesc, 0, wx.ALL | wx.EXPAND, 5) bSizer1.Add(gSizer51, 1, wx.EXPAND, 5) self.m_staticline71 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) bSizer1.Add(self.m_staticline71, 0, wx.EXPAND | wx.ALL, 5) gSizer6 = wx.GridSizer(0, 2, 0, 0) self.m_checkBox5 = wx.CheckBox(self, wx.ID_ANY, u"MySQL. Output DDL file name:", wx.DefaultPosition, wx.DefaultSize, 0) self.m_checkBox5.SetValue(True) gSizer6.Add(self.m_checkBox5, 0, wx.ALL, 5) self.textCtrl_MySQLFileName = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) gSizer6.Add(self.textCtrl_MySQLFileName, 0, wx.ALL, 5) self.m_staticText6111 = wx.StaticText( self, wx.ID_ANY, u"Description comment inside the DDL file", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText6111.Wrap(-1) gSizer6.Add(self.m_staticText6111, 0, wx.ALL, 5) self.textCtrl_MySQLFileDesc = wx.TextCtrl( self, wx.ID_ANY, u"-- This is a Data Definition Language (DDL) script that\n-- generates a blank schema of the Water Management Data Model (WaM-DaM)\n-- for MySQL database\n\n-- Generated by \n--Adel Abdallah \n--May 1, 2017\n--based on WaMDaM XML design named --WaMDaMMay1_2017.xml \n--generated by DbWrench V4.03 @ http://www.dbwrench.com\n-- WaMDaM All rights reserved. See Licence @ wamdam.org \n\n--Open MySQL Workbench, Create a New SQL Tab for Executing queries\n--Simply copy all this script and paste into the new window of \"create query\"\n--Then click execute. The script should run successfully and create the 41 empty tables of WaM-DaM", wx.DefaultPosition, wx.DefaultSize, 0) gSizer6.Add(self.textCtrl_MySQLFileDesc, 0, wx.ALL | wx.EXPAND, 5) bSizer1.Add(gSizer6, 1, wx.EXPAND, 5) self.m_staticline8 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) bSizer1.Add(self.m_staticline8, 0, wx.EXPAND | wx.ALL, 5) self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, u"Select where you want your database files to be created to", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText2.Wrap(-1) bSizer1.Add(self.m_staticText2, 0, wx.ALL, 5) self.dirPicker_DDLfiles = wx.DirPickerCtrl( self, wx.ID_ANY, wx.EmptyString, u"Select a folder", wx.DefaultPosition, wx.DefaultSize, wx.DIRP_DEFAULT_STYLE) bSizer1.Add(self.dirPicker_DDLfiles, 0, wx.ALL | wx.EXPAND, 5) gSizer4 = wx.GridSizer(1, 2, 0, 0) self.button_generate = wx.Button(self, wx.ID_ANY, u"Generate", wx.DefaultPosition, wx.DefaultSize, 0) gSizer4.Add(self.button_generate, 0, wx.ALL | wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT, 5) self.button_cancel = wx.Button(self, wx.ID_ANY, u"Cancel", wx.DefaultPosition, wx.DefaultSize, 0) gSizer4.Add(self.button_cancel, 0, wx.ALL | wx.ALIGN_BOTTOM, 5) bSizer1.Add(gSizer4, 1, wx.EXPAND, 5) self.SetSizer(bSizer1) self.Layout() self.m_statusBar4 = self.CreateStatusBar(1, wx.ST_SIZEGRIP, wx.ID_ANY) self.m_menubar3 = wx.MenuBar(0) self.m_menu3 = wx.Menu() self.m_menuItem1 = wx.MenuItem(self.m_menu3, wx.ID_ANY, u"MyMenuItem", wx.EmptyString, wx.ITEM_NORMAL) self.m_menu3.AppendItem(self.m_menuItem1) self.m_menuItem2 = wx.MenuItem(self.m_menu3, wx.ID_ANY, u"MyMenuItem", wx.EmptyString, wx.ITEM_NORMAL) self.m_menu3.AppendItem(self.m_menuItem2) self.m_menubar3.Append(self.m_menu3, u"About") self.SetMenuBar(self.m_menubar3) self.Centre(wx.BOTH) # Connect Events self.filePicker_xmlfile.Bind(wx.EVT_FILEPICKER_CHANGED, self.filePicker_xmlfileOnFileChanged) self.dirPicker_DDLfiles.Bind(wx.EVT_DIRPICKER_CHANGED, self.dirPicker_DDLfilesOnDirChanged) self.button_generate.Bind(wx.EVT_BUTTON, self.button_generateOnButtonClick) self.button_cancel.Bind(wx.EVT_BUTTON, self.button_cancelOnButtonClick)
def __init__(self, parent, stuff, item, context=None): # Had to manually set the size here, otherwise column widths couldn't be calculated correctly. See #1878 wx.Panel.__init__(self, parent, size=(1000, 1000)) self.SetBackgroundColour( wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE)) mainSizer = wx.BoxSizer(wx.VERTICAL) self.paramList = wx.lib.agw.hypertreelist.HyperTreeList( self, wx.ID_ANY, agwStyle=wx.TR_HIDE_ROOT | wx.TR_NO_LINES | wx.TR_FULL_ROW_HIGHLIGHT | wx.TR_HAS_BUTTONS) self.paramList.SetBackgroundColour( wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)) mainSizer.Add(self.paramList, 1, wx.ALL | wx.EXPAND, 0) self.SetSizer(mainSizer) self.toggleView = AttributeView.NORMAL self.stuff = stuff self.item = item self.attrInfo = {} self.attrValues = {} self._fetchValues() self.paramList.AddColumn("Attribute") self.paramList.AddColumn("Current Value") if self.stuff is not None: self.paramList.AddColumn("Base Value") self.m_staticline = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) mainSizer.Add(self.m_staticline, 0, wx.EXPAND) bSizer = wx.BoxSizer(wx.HORIZONTAL) self.toggleViewBtn = wx.ToggleButton(self, wx.ID_ANY, "View Raw Data", wx.DefaultPosition, wx.DefaultSize, 0) bSizer.Add(self.toggleViewBtn, 0, wx.ALIGN_CENTER_VERTICAL) self.exportStatsBtn = wx.ToggleButton(self, wx.ID_ANY, "Export Item Stats", wx.DefaultPosition, wx.DefaultSize, 0) bSizer.Add(self.exportStatsBtn, 0, wx.ALIGN_CENTER_VERTICAL) if stuff is not None: self.refreshBtn = wx.Button(self, wx.ID_ANY, "Refresh", wx.DefaultPosition, wx.DefaultSize, wx.BU_EXACTFIT) bSizer.Add(self.refreshBtn, 0, wx.ALIGN_CENTER_VERTICAL) self.refreshBtn.Bind(wx.EVT_BUTTON, self.RefreshValues) mainSizer.Add(bSizer, 0, wx.ALIGN_RIGHT) self.imageList = wx.ImageList(16, 16) self.PopulateList() self.toggleViewBtn.Bind(wx.EVT_TOGGLEBUTTON, self.ToggleViewMode) self.exportStatsBtn.Bind(wx.EVT_TOGGLEBUTTON, self.ExportItemStats)
def _create_horizontal_line(self, sizer): line = wx.StaticLine(self, size=(20, -1), style=wx.LI_HORIZONTAL) sizer.Add( line, border=5, flag=wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP)
def __init__(self, parent, title): """ :param parent: Parent object calling the MainFrame. :param title: Title for the MainFrame window. """ wx.Frame.__init__(self, parent, title=title, size=(600, 700)) self.scan_panel = wx.Panel(self) # Variables self.run_thread = None self.zoom_thread = None self.corr_thread = None self.console_frame = None self.curr_row = 0 # Grid coordinate row self.curr_col = 0 # Grid coordinate col self.values = None # np.array storing area scan values self.zoom_values = None # np.array storing zoom scan values self.grid = None # np.array storing 'trajectory' of scans self.max_fname = '' # Name of the image file for the max measurement # Accelerator Table/Shortcut Keys save_id = 115 run_id = 116 manual_id = 117 reset_id = 118 help_id = 119 self.accel_tbl = wx.AcceleratorTable([ (wx.ACCEL_CTRL, ord('s'), save_id), (wx.ACCEL_CTRL, ord('r'), run_id), (wx.ACCEL_CTRL, ord('m'), manual_id), (wx.ACCEL_CTRL, ord('t'), reset_id), (wx.ACCEL_CTRL, ord('h'), help_id) ]) self.SetAcceleratorTable(self.accel_tbl) # UI Elements self.scan_settings_text = wx.StaticText(self.scan_panel, label="Area Scan Settings") self.scan_settings_text.SetFont( wx.Font(10, wx.DECORATIVE, wx.NORMAL, wx.BOLD)) self.x_distance_text = wx.StaticText(self.scan_panel, label="X Distance") self.x_distance_text.SetFont( wx.Font(9, wx.DECORATIVE, wx.NORMAL, wx.BOLD)) self.xdesc_text = wx.StaticText( self.scan_panel, label="Horizontal length of measurement region (in cm)") self.x_tctrl = wx.TextCtrl(self.scan_panel) self.x_tctrl.SetValue(str(4 * 2.8)) self.y_distance_text = wx.StaticText(self.scan_panel, label="Y Distance") self.y_distance_text.SetFont( wx.Font(9, wx.DECORATIVE, wx.NORMAL, wx.BOLD)) self.ydesc_text = wx.StaticText( self.scan_panel, label="Vertical length of measurement region (in cm)") self.y_tctrl = wx.TextCtrl(self.scan_panel) self.y_tctrl.SetValue(str(6 * 2.8)) self.grid_step_dist_text = wx.StaticText(self.scan_panel, label="Grid Step Distance") self.grid_step_dist_text.SetFont( wx.Font(9, wx.DECORATIVE, wx.NORMAL, wx.BOLD)) self.griddesc_text = wx.StaticText( self.scan_panel, label="Distance between measurement points (in cm)") self.grid_tctrl = wx.TextCtrl(self.scan_panel) self.grid_tctrl.SetValue(str(2.8)) self.times_text = wx.StaticText(self.scan_panel, label="Dwell Time Settings") self.times_text.SetFont(wx.Font(9, wx.DECORATIVE, wx.NORMAL, wx.BOLD)) self.dwell_time_text = wx.StaticText( self.scan_panel, label="Pre-Measurement Dwell Time (Area scan, in sec)") self.dwell_tctrl = wx.TextCtrl(self.scan_panel) self.dwell_tctrl.SetValue(str(3)) self.zoom_scan_dwell_time_text = wx.StaticText( self.scan_panel, label="Pre-Measurement Dwell Time (Zoom scan, in sec)") self.zdwell_tctrl = wx.TextCtrl(self.scan_panel) self.zdwell_tctrl.SetValue(str(3)) self.span_text = wx.StaticText(self.scan_panel, label="Span Settings") self.span_text.SetFont(wx.Font(9, wx.DECORATIVE, wx.NORMAL, wx.BOLD)) self.span_start_text = wx.StaticText(self.scan_panel, label="Start (MHz):") self.span_start_tctrl = wx.TextCtrl(self.scan_panel) self.span_start_tctrl.SetValue(str(0.005)) self.span_stop_text = wx.StaticText(self.scan_panel, label="Stop (MHz):") self.span_stop_tctrl = wx.TextCtrl(self.scan_panel) self.span_stop_tctrl.SetValue(str(5)) self.save_dir_text = wx.StaticText(self.scan_panel, label="Save Directory") self.save_dir_text.SetFont( wx.Font(9, wx.DECORATIVE, wx.NORMAL, wx.BOLD)) self.savedesc_text = wx.StaticText( self.scan_panel, label="Directory to save measurement text and image files") self.save_tctrl = wx.TextCtrl(self.scan_panel) # self.save_tctrl.SetValue("C:\\Users\changhwan.choi\Desktop\hello") # TODO :Debugging self.save_btn = wx.Button(self.scan_panel, save_id, "Browse") self.Bind(wx.EVT_BUTTON, self.select_save_dir, self.save_btn) self.auto_checkbox = wx.CheckBox( self.scan_panel, label="Automatic Measurements") # TODO: may not use self.auto_checkbox.SetValue(True) self.test_info_text = wx.StaticText(self.scan_panel, label="Test Information") self.test_info_text.SetFont( wx.Font(10, wx.DECORATIVE, wx.NORMAL, wx.BOLD)) self.eut_model_text = wx.StaticText(self.scan_panel, label="Model of EUT: ") self.eut_model_tctrl = wx.TextCtrl(self.scan_panel) self.eut_sn_text = wx.StaticText(self.scan_panel, label="S/N of EUT: ") self.eut_sn_tctrl = wx.TextCtrl(self.scan_panel) self.initials_text = wx.StaticText(self.scan_panel, label="Test Engineer Initials: ") self.initials_tctrl = wx.TextCtrl(self.scan_panel) self.test_num_text = wx.StaticText(self.scan_panel, label="Test Number: ") self.test_num_tctrl = wx.TextCtrl(self.scan_panel) self.measurement_specs_text = wx.StaticText( self.scan_panel, label="Measurement Specifications") self.measurement_specs_text.SetFont( wx.Font(10, wx.DECORATIVE, wx.NORMAL, wx.BOLD)) self.type_rbox = wx.RadioBox(self.scan_panel, label="Type", choices=['Limb', 'Body'], style=wx.RA_SPECIFY_COLS, majorDimension=1) self.field_rbox = wx.RadioBox( self.scan_panel, label="Field", choices=['Electric', 'Magnetic (Mode A)', 'Magnetic (Mode B)'], style=wx.RA_SPECIFY_COLS, majorDimension=1) self.side_rbox = wx.RadioBox( self.scan_panel, label="Side", choices=['Front', 'Back', 'Top', 'Bottom', 'Left', 'Right'], style=wx.RA_SPECIFY_COLS, majorDimension=1) self.side_rbox.SetSelection(1) self.rbw_rbox = wx.RadioBox(self.scan_panel, label="RBW", choices=[ '300 kHz', '10 kHz', '100 kHz', '3 kHz', '30 kHz', '1 kHz' ], style=wx.RA_SPECIFY_COLS, majorDimension=2) self.rbw_rbox.SetSelection(2) self.reset_btn = wx.Button(self.scan_panel, reset_id, "Reset Motors") self.Bind(wx.EVT_BUTTON, self.reset_motors, self.reset_btn) self.manual_btn = wx.Button(self.scan_panel, manual_id, "Manual Movement") self.Bind(wx.EVT_BUTTON, self.manual_move, self.manual_btn) self.run_btn = wx.Button(self.scan_panel, run_id, "Run") self.Bind(wx.EVT_BUTTON, self.run_area_scan, self.run_btn) # Menu Bar menubar = wx.MenuBar() helpmenu = wx.Menu() shortcuthelp_item = wx.MenuItem(helpmenu, help_id, text="Shortcuts", kind=wx.ITEM_NORMAL) helpmenu.Append(shortcuthelp_item) menubar.Append(helpmenu, 'Help') self.Bind(wx.EVT_MENU, self.showshortcuts, id=help_id) self.SetMenuBar(menubar) # Sizers/Layout, Static Lines, & Static Boxes self.saveline_sizer = wx.BoxSizer(wx.HORIZONTAL) self.checkbox_sizer = wx.BoxSizer(wx.HORIZONTAL) self.span_sizer = wx.BoxSizer(wx.HORIZONTAL) self.test_info_sizer = wx.GridSizer(rows=4, cols=2, hgap=0, vgap=0) self.text_input_sizer = wx.BoxSizer(wx.VERTICAL) self.radio_input_sizer = wx.BoxSizer(wx.VERTICAL) self.btn_sizer = wx.BoxSizer(wx.HORIZONTAL) self.mainh_sizer = wx.BoxSizer(wx.HORIZONTAL) self.mainv_sizer = wx.BoxSizer(wx.VERTICAL) self.text_input_sizer.Add(self.scan_settings_text, proportion=0, border=3, flag=wx.BOTTOM) self.text_input_sizer.Add(self.x_distance_text, proportion=0, flag=wx.LEFT) self.text_input_sizer.Add(self.xdesc_text, proportion=0, flag=wx.LEFT) self.text_input_sizer.Add(self.x_tctrl, proportion=0, flag=wx.LEFT | wx.EXPAND) self.text_input_sizer.Add(self.y_distance_text, proportion=0, flag=wx.LEFT) self.text_input_sizer.Add(self.ydesc_text, proportion=0, flag=wx.LEFT) self.text_input_sizer.Add(self.y_tctrl, proportion=0, flag=wx.LEFT | wx.EXPAND) self.text_input_sizer.Add(self.grid_step_dist_text, proportion=0, flag=wx.LEFT) self.text_input_sizer.Add(self.griddesc_text, proportion=0, flag=wx.LEFT) self.text_input_sizer.Add(self.grid_tctrl, proportion=0, flag=wx.LEFT | wx.EXPAND) self.text_input_sizer.Add(self.times_text, proportion=0, flag=wx.LEFT) self.text_input_sizer.Add(self.dwell_time_text, proportion=0, flag=wx.LEFT) self.text_input_sizer.Add(self.dwell_tctrl, proportion=0, flag=wx.LEFT) self.text_input_sizer.Add(self.zoom_scan_dwell_time_text, proportion=0, flag=wx.LEFT) self.text_input_sizer.Add(self.zdwell_tctrl, proportion=0, flag=wx.LEFT) self.text_input_sizer.Add(self.span_text, proportion=0, flag=wx.LEFT) self.span_sizer.Add(self.span_start_text, proportion=0, flag=wx.LEFT) self.span_sizer.Add(self.span_start_tctrl, proportion=1, flag=wx.LEFT | wx.RIGHT | wx.EXPAND, border=5) self.span_sizer.Add(self.span_stop_text, proportion=0, flag=wx.LEFT) self.span_sizer.Add(self.span_stop_tctrl, proportion=1, flag=wx.LEFT | wx.EXPAND, border=5) self.text_input_sizer.Add(self.span_sizer, proportion=0, flag=wx.EXPAND) self.text_input_sizer.Add(self.save_dir_text, proportion=0, flag=wx.LEFT) self.text_input_sizer.Add(self.savedesc_text, proportion=0, flag=wx.LEFT) self.saveline_sizer.Add(self.save_tctrl, proportion=1, flag=wx.LEFT | wx.EXPAND) self.saveline_sizer.Add(self.save_btn, proportion=0, flag=wx.ALIGN_RIGHT | wx.LEFT, border=5) self.checkbox_sizer.Add(self.auto_checkbox, proportion=0, flag=wx.ALIGN_LEFT | wx.ALL, border=5) self.text_input_sizer.Add(self.saveline_sizer, proportion=0, flag=wx.LEFT | wx.EXPAND) self.text_input_sizer.Add(self.checkbox_sizer, proportion=0, flag=wx.LEFT | wx.EXPAND) self.text_input_sizer.Add(wx.StaticLine(self.scan_panel, wx.ID_ANY, style=wx.LI_HORIZONTAL), proportion=0, border=5, flag=wx.TOP | wx.BOTTOM | wx.EXPAND) self.text_input_sizer.Add(self.test_info_text, proportion=0, flag=wx.BOTTOM, border=3) self.test_info_sizer.Add(self.eut_model_text, proportion=0) self.test_info_sizer.Add(self.eut_model_tctrl, proportion=0, flag=wx.EXPAND) self.test_info_sizer.Add(self.eut_sn_text, proportion=0) self.test_info_sizer.Add(self.eut_sn_tctrl, proportion=0, flag=wx.EXPAND) self.test_info_sizer.Add(self.initials_text, proportion=0) self.test_info_sizer.Add(self.initials_tctrl, proportion=0, flag=wx.EXPAND) self.test_info_sizer.Add(self.test_num_text, proportion=0) self.test_info_sizer.Add(self.test_num_tctrl, proportion=0, flag=wx.EXPAND) self.text_input_sizer.Add(self.test_info_sizer, proportion=0, flag=wx.EXPAND) self.radio_input_sizer.Add(self.measurement_specs_text, proportion=0, border=3, flag=wx.BOTTOM) self.radio_input_sizer.Add(self.type_rbox, proportion=0, flag=wx.ALL | wx.EXPAND) self.radio_input_sizer.Add(self.field_rbox, proportion=0, flag=wx.ALL | wx.EXPAND) self.radio_input_sizer.Add(self.side_rbox, proportion=0, flag=wx.ALL | wx.EXPAND) self.radio_input_sizer.Add(self.rbw_rbox, proportion=0, flag=wx.ALL | wx.EXPAND) self.mainh_sizer.Add(self.text_input_sizer, proportion=2, border=5, flag=wx.ALL | wx.EXPAND) self.mainh_sizer.Add(wx.StaticLine(self.scan_panel, wx.ID_ANY, style=wx.LI_VERTICAL), proportion=0, border=5, flag=wx.TOP | wx.BOTTOM | wx.EXPAND) self.mainh_sizer.Add(self.radio_input_sizer, proportion=1, border=5, flag=wx.ALL | wx.EXPAND) self.btn_sizer.Add(self.reset_btn, proportion=1, border=5, flag=wx.ALIGN_RIGHT | wx.LEFT | wx.TOP | wx.BOTTOM) self.btn_sizer.Add(self.manual_btn, proportion=1, border=5, flag=wx.ALIGN_RIGHT | wx.LEFT | wx.TOP | wx.BOTTOM) self.btn_sizer.Add(self.run_btn, proportion=1, border=5, flag=wx.ALIGN_RIGHT | wx.ALL) self.mainv_sizer.Add(self.mainh_sizer, proportion=1, border=0, flag=wx.ALL | wx.EXPAND) self.mainv_sizer.Add(wx.StaticLine(self.scan_panel, wx.ID_ANY, style=wx.LI_HORIZONTAL), proportion=0, border=0, flag=wx.ALL | wx.EXPAND) self.mainv_sizer.Add(self.btn_sizer, proportion=0, border=5, flag=wx.ALIGN_RIGHT) self.scan_panel.SetSizer(self.mainv_sizer) pan_size = self.scan_panel.GetSize() print(pan_size) self.SetSize(pan_size) self.SetMinSize(pan_size) self.SetMaxSize(pan_size) self.SetAutoLayout(True) # self.scan_panel.Fit() self.mainv_sizer.Fit(self.scan_panel) self.Layout() self.Show(True)
def __init__(self, parent, id, name, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE | wx.FRAME_NO_TASKBAR | wx.FRAME_FLOAT_ON_PARENT | wx.WANTS_CHARS): # k=wx.NewId();ide=map(lambda x: x+k, range(0,100)) ide = [wx.NewId() for i in range(100)] #kwds["style"] = wx.CAPTION|wx.SYSTEM_MENU #wx.Frame.__init__(self, *args, **kwds) wx.Frame.__init__(self, parent, id, name, pos, size, style) self.parent = parent self.panel_1 = wx.Panel(self, -1) self.notebook_1 = wx.Notebook(self.panel_1, -1, style=0) self.notebook_1_pane_3 = wx.Panel(self.notebook_1, -1) self.notebook_1_pane_2 = wx.Panel(self.notebook_1, -1) self.notebook_1_pane_1 = wx.Panel(self.notebook_1, -1) self.label_top = wx.StaticText( self.panel_1, -1, "Use the options below to change the clock;\nthe main buttons on top of each category reset to its defaults." ) self.static_line_1 = wx.StaticLine(self.panel_1, -1) self.button_1 = wx.Button(self.notebook_1_pane_1, ide[1], "SetClockStyle") self.static_line_2 = wx.StaticLine(self.notebook_1_pane_1, -1) self.button_2 = wx.Button(self.notebook_1_pane_1, ide[3], "styles...") self.static_line_3 = wx.StaticLine(self.notebook_1_pane_1, -1, style=wx.LI_VERTICAL) self.button_3 = wx.Button(self.notebook_1_pane_1, ide[2], "SetTickStyles") self.static_line_4 = wx.StaticLine(self.notebook_1_pane_1, -1) self.button_4 = wx.Button(self.notebook_1_pane_1, ide[4], "styles...") self.button_22 = wx.Button(self.notebook_1_pane_1, ide[22], "minutes...") self.static_line_5 = wx.StaticLine(self.notebook_1_pane_1, -1) self.button_5 = wx.Button(self.notebook_1_pane_1, ide[5], "SetShadowColour") self.static_line_6 = wx.StaticLine(self.notebook_1_pane_1, -1) self.button_6 = csel.ColourSelect(self.notebook_1_pane_1, ide[6], "all...") self.static_line_7 = wx.StaticLine(self.notebook_1_pane_1, -1, style=wx.LI_VERTICAL) self.button_7 = wx.Button(self.notebook_1_pane_1, ide[7], "SetWatchPenBrush") self.static_line_8 = wx.StaticLine(self.notebook_1_pane_1, -1) self.button_8 = csel.ColourSelect(self.notebook_1_pane_1, ide[8], "Pen colour...") self.button_9 = csel.ColourSelect(self.notebook_1_pane_1, ide[9], "Brush colour...") self.button_10 = wx.Button(self.notebook_1_pane_2, ide[10], "SetTickColours") self.static_line_8 = wx.StaticLine(self.notebook_1_pane_2, -1) self.button_11 = csel.ColourSelect( self.notebook_1_pane_2, ide[11], "hours...", colour=self.parent.tickMarkHoursPen.GetColour()) self.button_12 = csel.ColourSelect( self.notebook_1_pane_2, ide[12], "minutes...", colour=self.parent.tickMarkMinutesPen.GetColour()) self.static_line_10 = wx.StaticLine(self.notebook_1_pane_2, -1, style=wx.LI_VERTICAL) self.button_13 = wx.Button(self.notebook_1_pane_2, ide[13], "SetTickSizes") self.static_line_11 = wx.StaticLine(self.notebook_1_pane_2, -1) self.label_1 = wx.StaticText(self.notebook_1_pane_2, -1, "hours") self.spin_ctrl_1 = wx.SpinCtrl(self.notebook_1_pane_2, ide[71], "10", min=1, max=100) self.label_2 = wx.StaticText(self.notebook_1_pane_2, -1, "minutes") self.spin_ctrl_2 = wx.SpinCtrl(self.notebook_1_pane_2, ide[72], "5", min=0, max=100) self.label_3 = wx.StaticText(self.notebook_1_pane_2, -1, "offset") self.spin_ctrl_3 = wx.SpinCtrl(self.notebook_1_pane_2, ide[73], "0", min=0, max=100) self.static_line_12 = wx.StaticLine(self.notebook_1_pane_2, -1, style=wx.LI_VERTICAL) self.button_14 = wx.Button(self.notebook_1_pane_2, ide[14], "SetTickFonts") self.static_line_13 = wx.StaticLine(self.notebook_1_pane_2, -1) self.button_15 = wx.Button(self.notebook_1_pane_2, ide[15], "hours...") self.button_16 = wx.Button(self.notebook_1_pane_2, ide[16], "minutes...") self.button_17 = wx.Button(self.notebook_1_pane_3, ide[17], "SetHandWeights") self.static_line_14 = wx.StaticLine(self.notebook_1_pane_3, -1) self.label_4 = wx.StaticText(self.notebook_1_pane_3, -1, "hours") self.spin_ctrl_4 = wx.SpinCtrl(self.notebook_1_pane_3, ide[74], "5", min=0, max=100) self.label_5 = wx.StaticText(self.notebook_1_pane_3, -1, "minutes") self.spin_ctrl_5 = wx.SpinCtrl(self.notebook_1_pane_3, ide[75], "3", min=0, max=100) self.label_6 = wx.StaticText(self.notebook_1_pane_3, -1, "seconds") self.spin_ctrl_6 = wx.SpinCtrl(self.notebook_1_pane_3, ide[76], "1", min=0, max=100) self.static_line_15 = wx.StaticLine(self.notebook_1_pane_3, -1, style=wx.LI_VERTICAL) self.button_18 = wx.Button(self.notebook_1_pane_3, ide[18], "SetHandColours") self.static_line_16 = wx.StaticLine(self.notebook_1_pane_3, -1) self.button_19 = csel.ColourSelect(self.notebook_1_pane_3, ide[19], "hours...") self.button_20 = csel.ColourSelect(self.notebook_1_pane_3, ide[20], "minutes...") self.button_21 = csel.ColourSelect(self.notebook_1_pane_3, ide[21], "seconds...") self.__set_properties() self.__do_layout() self.Bind(wx.EVT_BUTTON, self.OnEventsHook, id=ide[0], id2=ide[29]) self.Bind(csel.EVT_COLOURSELECT, self.OnEventsHook, id=ide[0], id2=ide[29]) self.Bind(wx.EVT_SPINCTRL, self.OnEventsHook, id=ide[71], id2=ide[80]) self.Bind(wx.EVT_RADIOBUTTON, self.OnEventsHook, id=ide[51], id2=ide[60]) self.Bind(wx.EVT_WINDOW_DESTROY, self.OnQuit) self.ide = ide
def __init__( self, parent, id, title, size=wx.DefaultSize, pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE, name='dialog' ): # Instead of calling wx.Dialog.__init__ we precreate the dialog # so we can set an extra style that must be set before # creation, and then we create the GUI object using the Create # method. wx.Dialog.__init__(self) self.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP) self.Create(parent, id, title, pos, size, style, name) # Now continue with the normal construction of the dialog # contents sizer = wx.BoxSizer(wx.VERTICAL) label = wx.StaticText(self, -1, "This is a wx.Dialog") label.SetHelpText("This is the help text for the label") sizer.Add(label, 0, wx.ALIGN_CENTRE|wx.ALL, 5) box = wx.BoxSizer(wx.HORIZONTAL) label = wx.StaticText(self, -1, "Field #1:") label.SetHelpText("This is the help text for the label") box.Add(label, 0, wx.ALIGN_CENTRE|wx.ALL, 5) text = wx.TextCtrl(self, -1, "", size=(80,-1)) text.SetHelpText("Here's some help text for field #1") box.Add(text, 1, wx.ALIGN_CENTRE|wx.ALL, 5) sizer.Add(box, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) box = wx.BoxSizer(wx.HORIZONTAL) label = wx.StaticText(self, -1, "Field #2:") label.SetHelpText("This is the help text for the label") box.Add(label, 0, wx.ALIGN_CENTRE|wx.ALL, 5) text = wx.TextCtrl(self, -1, "", size=(80,-1)) text.SetHelpText("Here's some help text for field #2") box.Add(text, 1, wx.ALIGN_CENTRE|wx.ALL, 5) sizer.Add(box, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) line = wx.StaticLine(self, -1, size=(20,-1), style=wx.LI_HORIZONTAL) sizer.Add(line, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT|wx.TOP, 5) btnsizer = wx.StdDialogButtonSizer() if wx.Platform != "__WXMSW__": btn = wx.ContextHelpButton(self) btnsizer.AddButton(btn) btn = wx.Button(self, wx.ID_OK) btn.SetHelpText("The OK button completes the dialog") btn.SetDefault() btnsizer.AddButton(btn) btn = wx.Button(self, wx.ID_CANCEL) btn.SetHelpText("The Cancel button cancels the dialog. (Cool, huh?)") btnsizer.AddButton(btn) btnsizer.Realize() sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) self.SetSizer(sizer) sizer.Fit(self)
def InitUI(self): panel=wx.Panel(self) self.up=wx.BitmapButton(panel, 1, wx.Bitmap(self.BASE_PATH+'/icons/go-up.png'), (-1, -1), (50, 50)) self.dn=wx.BitmapButton(panel, 2, wx.Bitmap(self.BASE_PATH+'/icons/go-down.png'), (-1, -1), (50, 50)) self.lt=wx.BitmapButton(panel, 3, wx.Bitmap(self.BASE_PATH+'/icons/go-previous.png'), (-1, -1), (50, 50)) self.rt=wx.BitmapButton(panel, 4, wx.Bitmap(self.BASE_PATH+'/icons/go-next.png'), (-1, -1), (50, 50)) self.ud=wx.BitmapButton(panel, 5, wx.Bitmap(self.BASE_PATH+'/icons/media-seek-backward.png'), (-1, -1), (50, 50)) self.rf=wx.BitmapButton(panel, 6, wx.Bitmap(self.BASE_PATH+'/icons/view-refresh.png'), (-1, -1), (50, 50)) self.fw=wx.BitmapButton(panel, 7, wx.Bitmap(self.BASE_PATH+'/icons/media-seek-forward.png'), (-1, -1), (50, 50)) self.rg=wx.BitmapButton(panel, 8, wx.Bitmap(self.BASE_PATH+'/icons/media-playback-stop.png'), (-1, -1), (50, 50)) self.pg=wx.BitmapButton(panel, 9, wx.Bitmap(self.BASE_PATH+'/icons/media-skip-backward.png'), (-1, -1), (50, 50)) self.ng=wx.BitmapButton(panel, 10, wx.Bitmap(self.BASE_PATH+'/icons/media-skip-forward.png'), (-1, -1), (50, 50)) self.up.SetToolTip(wx.ToolTip('move player up [cursor up]')) self.dn.SetToolTip(wx.ToolTip('move player down [cursor down]')) self.lt.SetToolTip(wx.ToolTip('move player left [cursor left]')) self.rt.SetToolTip(wx.ToolTip('move player right [cursor right]')) self.ud.SetToolTip(wx.ToolTip('undo last move [key="u"]')) self.rf.SetToolTip(wx.ToolTip('refresh/repaint playground [key="F5"]')) self.fw.SetToolTip(wx.ToolTip('next move (in solution) [key="s"]')) self.rg.SetToolTip(wx.ToolTip('restart game [key="ESC"]')) self.pg.SetToolTip(wx.ToolTip('goto previous game [key="BACKSPACE"]')) self.ng.SetToolTip(wx.ToolTip('goto next game [key="SPACE"]')) self.up.Bind(wx.EVT_BUTTON, self.up_klick) self.dn.Bind(wx.EVT_BUTTON, self.dn_klick) self.lt.Bind(wx.EVT_BUTTON, self.lt_klick) self.rt.Bind(wx.EVT_BUTTON, self.rt_klick) self.ud.Bind(wx.EVT_BUTTON, self.ud_klick) self.rf.Bind(wx.EVT_BUTTON, self.rf_klick) self.fw.Bind(wx.EVT_BUTTON, self.fw_klick) self.rg.Bind(wx.EVT_BUTTON, self.rg_klick) self.pg.Bind(wx.EVT_BUTTON, self.pg_klick) self.ng.Bind(wx.EVT_BUTTON, self.ng_klick) self.up.Bind(wx.EVT_CHAR, self.onChar) self.dn.Bind(wx.EVT_CHAR, self.onChar) self.lt.Bind(wx.EVT_CHAR, self.onChar) self.rt.Bind(wx.EVT_CHAR, self.onChar) self.ud.Bind(wx.EVT_CHAR, self.onChar) self.rf.Bind(wx.EVT_CHAR, self.onChar) self.fw.Bind(wx.EVT_CHAR, self.onChar) self.rg.Bind(wx.EVT_CHAR, self.onChar) self.pg.Bind(wx.EVT_CHAR, self.onChar) self.ng.Bind(wx.EVT_CHAR, self.onChar) sizer=wx.GridBagSizer(1, 1) border=2 sizer.Add(self.up, (0, 1), flag=wx.ALL|wx.GROW, border=border) sizer.Add(self.lt, (1, 0), flag=wx.ALL|wx.GROW, border=border) sizer.Add(self.rt, (1, 2), flag=wx.ALL|wx.GROW, border=border) sizer.Add(self.dn, (1, 1), flag=wx.ALL|wx.GROW, border=border) sizer.Add(wx.StaticLine(panel), pos=(2, 0), span=(1, 3), flag=wx.ALL|wx.GROW, border=border) sizer.Add(self.ud, (3, 0), flag=wx.ALL|wx.GROW, border=border) sizer.Add(self.rf, (3, 1), flag=wx.ALL|wx.GROW, border=border) sizer.Add(self.fw, (3, 2), flag=wx.ALL|wx.GROW, border=border) sizer.Add(wx.StaticLine(panel), pos=(4, 0), span=(1, 3), flag=wx.ALL|wx.GROW, border=border) sizer.Add(self.rg, (5, 0), (1, 3), flag=wx.ALL|wx.GROW, border=border) sizer.Add(wx.StaticLine(panel), pos=(6, 0), span=(1, 3), flag=wx.ALL|wx.GROW, border=border) sizer.Add(self.pg, (7, 0), flag=wx.ALL|wx.GROW, border=border) sizer.Add(self.ng, (7, 2), flag=wx.ALL|wx.GROW, border=border) panel.SetSizer(sizer) sizer.Fit(self) self.up.SetFocus()
def __init__(self, app, pos=wx.DefaultPosition, size=dlgSize, style=wx.DEFAULT_DIALOG_STYLE | wx.DIALOG_NO_PARENT | wx.TAB_TRAVERSAL | wx.RESIZE_BORDER): wx.Dialog.__init__(self, None, -1, _translate("PsychoPy Preferences"), pos, size, style) self.app = app self.Center() self.prefsCfg = self.app.prefs.userPrefsCfg self.prefsSpec = self.app.prefs.prefsSpec sizer = wx.BoxSizer(wx.VERTICAL) line = wx.StaticLine(self, -1, size=(20, -1), style=wx.LI_HORIZONTAL) sizer.Add(line, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP, 5) #notebook, flatnotebook or something else? self.nb = fnb.FlatNotebook(self, style=fnb.FNB_NO_X_BUTTON | fnb.FNB_NO_NAV_BUTTONS) #self.nb = wx.Notebook(self)#notebook isn't nice with lots of pages self.ctrls = {} sectionOrdering = [ 'app', 'builder', 'coder', 'general', 'connections', 'keyBindings' ] for sectionName in sectionOrdering: prefsPage = self.makePrefsPage( parent=self.nb, sectionName=sectionName, prefsSection=self.prefsCfg[sectionName], specSection=self.prefsSpec[sectionName]) self.nb.AddPage(prefsPage, _localized[sectionName]) self.nb.SetSelection(self.app.prefs.pageCurrent) sizer.Add(self.nb, 1, wx.EXPAND) aTable = wx.AcceleratorTable([ (wx.ACCEL_NORMAL, wx.WXK_ESCAPE, wx.ID_CANCEL), (wx.ACCEL_NORMAL, wx.WXK_RETURN, wx.ID_OK), ]) self.SetAcceleratorTable(aTable) #create buttons line = wx.StaticLine(self, -1, size=(20, -1), style=wx.LI_HORIZONTAL) sizer.Add(line, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP, 5) btnsizer = wx.StdDialogButtonSizer() #ok btn = wx.Button(self, wx.ID_OK, _translate('OK')) btn.SetHelpText( _translate("Save prefs (in all sections) and close window")) btn.Bind(wx.EVT_BUTTON, self.onOK) btn.SetDefault() btnsizer.AddButton(btn) #cancel btn = wx.Button(self, wx.ID_CANCEL, _translate('Cancel')) btn.SetHelpText(_translate("Cancel any changes (to any panel)")) btn.Bind(wx.EVT_BUTTON, self.onCancel) btnsizer.AddButton(btn) #apply btn = wx.Button(self, wx.ID_APPLY, _translate('Apply')) btn.SetHelpText( _translate("Apply these prefs (in all sections) and continue")) btn.Bind(wx.EVT_BUTTON, self.onApply) btnsizer.AddButton(btn) #help btn = wx.Button(self, wx.ID_HELP, _translate('Help')) btn.SetHelpText(_translate("Get help on prefs")) btn.Bind(wx.EVT_BUTTON, self.onHelp) btnsizer.AddButton(btn) btnsizer.Realize() #add buttons to dlg sizer.Add(btnsizer, 0, wx.BOTTOM | wx.ALL, 5) self.SetSizerAndFit(sizer) self.SetAutoLayout(True) sizer.Fit(self)
def __init__(self, *args, **kwds): # begin wxGlade: All_Widgets_Frame.__init__ kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.SetSize((800, 417)) self.SetTitle(_("All Widgets")) _icon = wx.NullIcon _icon.CopyFromBitmap( wx.ArtProvider.GetBitmap(wx.ART_TIP, wx.ART_OTHER, (32, 32))) self.SetIcon(_icon) # Menu Bar self.All_Widgets_menubar = wx.MenuBar() global mn_IDUnix mn_IDUnix = wx.NewId() global mn_IDWindows mn_IDWindows = wx.NewId() wxglade_tmp_menu = wx.Menu() wxglade_tmp_menu.Append(wx.ID_OPEN, _("&Open"), _("Open an existing document")) wxglade_tmp_menu.Append(wx.ID_CLOSE, _("&Close file"), _("Close current document")) wxglade_tmp_menu.AppendSeparator() wxglade_tmp_menu.Append(wx.ID_EXIT, _("E&xit"), _("Finish program")) self.All_Widgets_menubar.Append(wxglade_tmp_menu, _("&File")) wxglade_tmp_menu = wx.Menu() self.All_Widgets_menubar.mn_Unix = wxglade_tmp_menu.Append( mn_IDUnix, _("Unix"), _("Use Unix line endings"), wx.ITEM_RADIO) self.Bind(wx.EVT_MENU, self.onSelectUnix, id=mn_IDUnix) self.All_Widgets_menubar.mn_Windows = wxglade_tmp_menu.Append( mn_IDWindows, _("Windows"), _("Use Windows line endings"), wx.ITEM_RADIO) self.Bind(wx.EVT_MENU, self.onSelectWindows, id=mn_IDWindows) wxglade_tmp_menu.AppendSeparator() self.All_Widgets_menubar.mn_RemoveTabs = wxglade_tmp_menu.Append( wx.ID_ANY, _("Remove Tabs"), _("Remove all leading tabs"), wx.ITEM_CHECK) self.Bind(wx.EVT_MENU, self.onRemoveTabs, self.All_Widgets_menubar.mn_RemoveTabs) self.All_Widgets_menubar.Append(wxglade_tmp_menu, _("&Edit")) wxglade_tmp_menu = wx.Menu() wxglade_tmp_menu.Append(wx.ID_HELP, _("Manual"), _("Show the application manual")) self.Bind(wx.EVT_MENU, self.onShowManual, id=wx.ID_HELP) wxglade_tmp_menu.AppendSeparator() wxglade_tmp_menu.Append(wx.ID_ABOUT, _("About"), _("Show the About dialog")) self.All_Widgets_menubar.Append(wxglade_tmp_menu, _("&Help")) self.SetMenuBar(self.All_Widgets_menubar) # Menu Bar end self.All_Widgets_statusbar = self.CreateStatusBar( 1, wx.STB_ELLIPSIZE_MIDDLE | wx.STB_SHOW_TIPS | wx.STB_SIZEGRIP) self.All_Widgets_statusbar.SetStatusWidths([-1]) # statusbar fields All_Widgets_statusbar_fields = [_("All Widgets statusbar")] for i in range(len(All_Widgets_statusbar_fields)): self.All_Widgets_statusbar.SetStatusText( All_Widgets_statusbar_fields[i], i) # Tool Bar self.All_Widgets_toolbar = wx.ToolBar(self, -1) self.All_Widgets_toolbar.AddTool( wx.ID_UP, _("UpDown"), wx.ArtProvider.GetBitmap(wx.ART_GO_UP, wx.ART_OTHER, (32, 32)), wx.ArtProvider.GetBitmap(wx.ART_GO_DOWN, wx.ART_OTHER, (32, 32)), wx.ITEM_CHECK, _("Up or Down"), _("Up or Down")) self.All_Widgets_toolbar.AddTool(wx.ID_OPEN, _("Open"), wx.Bitmap(32, 32), wx.NullBitmap, wx.ITEM_NORMAL, _("Open a new file"), _("Open a new file")) self.SetToolBar(self.All_Widgets_toolbar) self.All_Widgets_toolbar.Realize() # Tool Bar end sizer_1 = wx.FlexGridSizer(3, 1, 0, 0) self.notebook_1 = wx.Notebook(self, wx.ID_ANY, style=wx.NB_BOTTOM) sizer_1.Add(self.notebook_1, 1, wx.EXPAND, 0) self.notebook_1_wxBitmapButton = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxBitmapButton, _("wxBitmapButton")) sizer_13 = wx.FlexGridSizer(2, 2, 0, 0) self.bitmap_button_icon1 = wx.BitmapButton( self.notebook_1_wxBitmapButton, wx.ID_ANY, wx.Bitmap("icon.xpm", wx.BITMAP_TYPE_ANY)) self.bitmap_button_icon1.SetSize( self.bitmap_button_icon1.GetBestSize()) self.bitmap_button_icon1.SetDefault() sizer_13.Add(self.bitmap_button_icon1, 1, wx.ALL | wx.EXPAND, 5) self.bitmap_button_empty1 = wx.BitmapButton( self.notebook_1_wxBitmapButton, wx.ID_ANY, wx.Bitmap(10, 10)) self.bitmap_button_empty1.SetSize( self.bitmap_button_empty1.GetBestSize()) self.bitmap_button_empty1.SetDefault() sizer_13.Add(self.bitmap_button_empty1, 1, wx.ALL | wx.EXPAND, 5) self.bitmap_button_icon2 = wx.BitmapButton( self.notebook_1_wxBitmapButton, wx.ID_ANY, wx.Bitmap("icon.xpm", wx.BITMAP_TYPE_ANY), style=wx.BORDER_NONE | wx.BU_BOTTOM) self.bitmap_button_icon2.SetBitmapDisabled(wx.Bitmap(32, 32)) self.bitmap_button_icon2.SetSize( self.bitmap_button_icon2.GetBestSize()) self.bitmap_button_icon2.SetDefault() sizer_13.Add(self.bitmap_button_icon2, 1, wx.ALL | wx.EXPAND, 5) self.bitmap_button_art = wx.BitmapButton( self.notebook_1_wxBitmapButton, wx.ID_ANY, wx.ArtProvider.GetBitmap(wx.ART_GO_UP, wx.ART_OTHER, (32, 32)), style=wx.BORDER_NONE | wx.BU_BOTTOM) self.bitmap_button_art.SetSize(self.bitmap_button_art.GetBestSize()) self.bitmap_button_art.SetDefault() sizer_13.Add(self.bitmap_button_art, 1, wx.ALL | wx.EXPAND, 5) self.notebook_1_wxButton = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxButton, _("wxButton")) sizer_28 = wx.BoxSizer(wx.HORIZONTAL) self.button_3 = wx.Button(self.notebook_1_wxButton, wx.ID_BOLD, "") sizer_28.Add(self.button_3, 0, wx.ALL, 5) self.notebook_1_wxCalendarCtrl = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxCalendarCtrl, _("wxCalendarCtrl")) sizer_12 = wx.BoxSizer(wx.HORIZONTAL) self.calendar_ctrl_1 = wx.adv.CalendarCtrl( self.notebook_1_wxCalendarCtrl, wx.ID_ANY, style=wx.adv.CAL_MONDAY_FIRST | wx.adv.CAL_SEQUENTIAL_MONTH_SELECTION | wx.adv.CAL_SHOW_SURROUNDING_WEEKS | wx.adv.CAL_SHOW_WEEK_NUMBERS) sizer_12.Add(self.calendar_ctrl_1, 1, wx.ALL | wx.EXPAND, 5) self.notebook_1_wxGenericCalendarCtrl = wx.Panel( self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxGenericCalendarCtrl, _("wxGenericCalendarCtrl")) sizer_27 = wx.BoxSizer(wx.HORIZONTAL) self.generic_calendar_ctrl_1 = wx.adv.GenericCalendarCtrl( self.notebook_1_wxGenericCalendarCtrl, wx.ID_ANY, style=wx.adv.CAL_MONDAY_FIRST) sizer_27.Add(self.generic_calendar_ctrl_1, 1, wx.ALL | wx.EXPAND, 5) self.notebook_1_wxCheckBox = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxCheckBox, _("wxCheckBox")) sizer_21 = wx.GridSizer(2, 3, 0, 0) self.checkbox_1 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY, _("one (unchecked)")) sizer_21.Add(self.checkbox_1, 0, wx.EXPAND, 0) self.checkbox_2 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY, _("two (checked)")) self.checkbox_2.SetValue(1) sizer_21.Add(self.checkbox_2, 0, wx.EXPAND, 0) self.checkbox_3 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY, _("three"), style=wx.CHK_2STATE) sizer_21.Add(self.checkbox_3, 0, wx.EXPAND, 0) self.checkbox_4 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY, _("four (unchecked)"), style=wx.CHK_3STATE) self.checkbox_4.Set3StateValue(wx.CHK_UNCHECKED) sizer_21.Add(self.checkbox_4, 0, wx.EXPAND, 0) self.checkbox_5 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY, _("five (checked)"), style=wx.CHK_3STATE | wx.CHK_ALLOW_3RD_STATE_FOR_USER) self.checkbox_5.Set3StateValue(wx.CHK_CHECKED) sizer_21.Add(self.checkbox_5, 0, wx.EXPAND, 0) self.checkbox_6 = wx.CheckBox(self.notebook_1_wxCheckBox, wx.ID_ANY, _("six (undetermined)"), style=wx.CHK_3STATE | wx.CHK_ALLOW_3RD_STATE_FOR_USER) self.checkbox_6.Set3StateValue(wx.CHK_UNDETERMINED) sizer_21.Add(self.checkbox_6, 0, wx.EXPAND, 0) self.notebook_1_wxCheckListBox = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxCheckListBox, _("wxCheckListBox")) sizer_26 = wx.BoxSizer(wx.HORIZONTAL) self.check_list_box_1 = wx.CheckListBox( self.notebook_1_wxCheckListBox, wx.ID_ANY, choices=[_("one"), _("two"), _("three"), _("four")]) self.check_list_box_1.SetSelection(2) sizer_26.Add(self.check_list_box_1, 1, wx.ALL | wx.EXPAND, 5) self.notebook_1_wxChoice = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxChoice, _("wxChoice")) sizer_5 = wx.BoxSizer(wx.HORIZONTAL) self.choice_empty = wx.Choice(self.notebook_1_wxChoice, wx.ID_ANY, choices=[]) sizer_5.Add(self.choice_empty, 1, wx.ALL, 5) self.choice_filled = wx.Choice( self.notebook_1_wxChoice, wx.ID_ANY, choices=[_("Item 1"), _("Item 2 (pre-selected)")]) self.choice_filled.SetSelection(1) sizer_5.Add(self.choice_filled, 1, wx.ALL, 5) self.notebook_1_wxComboBox = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxComboBox, _("wxComboBox")) sizer_6 = wx.BoxSizer(wx.VERTICAL) sizer_7 = wx.BoxSizer(wx.HORIZONTAL) sizer_6.Add(sizer_7, 1, wx.EXPAND, 0) self.combo_box_empty = wx.ComboBox(self.notebook_1_wxComboBox, wx.ID_ANY, choices=[], style=0) sizer_7.Add(self.combo_box_empty, 1, wx.ALL, 5) self.combo_box_filled = wx.ComboBox( self.notebook_1_wxComboBox, wx.ID_ANY, choices=[_("Item 1 (pre-selected)"), _("Item 2")], style=0) self.combo_box_filled.SetSelection(0) sizer_7.Add(self.combo_box_filled, 1, wx.ALL, 5) self.notebook_1_wxDatePickerCtrl = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxDatePickerCtrl, _("wxDatePickerCtrl")) sizer_17 = wx.BoxSizer(wx.HORIZONTAL) self.datepicker_ctrl_1 = wx.adv.DatePickerCtrl( self.notebook_1_wxDatePickerCtrl, wx.ID_ANY, style=wx.adv.DP_SHOWCENTURY) sizer_17.Add(self.datepicker_ctrl_1, 1, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.notebook_1_wxGauge = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxGauge, _("wxGauge")) sizer_15 = wx.BoxSizer(wx.HORIZONTAL) self.gauge_1 = wx.Gauge(self.notebook_1_wxGauge, wx.ID_ANY, 20) sizer_15.Add(self.gauge_1, 1, wx.ALL, 5) self.notebook_1_wxGrid = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxGrid, _("wxGrid")) sizer_19 = wx.BoxSizer(wx.HORIZONTAL) self.grid_1 = wx.grid.Grid(self.notebook_1_wxGrid, wx.ID_ANY, size=(1, 1)) self.grid_1.CreateGrid(10, 3) self.grid_1.SetSelectionMode(wx.grid.Grid.SelectColumns) self.grid_1.SetColLabelValue(1, _("B\nB")) sizer_19.Add(self.grid_1, 1, wx.EXPAND, 0) self.notebook_1_wxHyperlinkCtrl = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxHyperlinkCtrl, _("wxHyperlinkCtrl")) sizer_20 = wx.BoxSizer(wx.HORIZONTAL) self.hyperlink_1 = wx.adv.HyperlinkCtrl( self.notebook_1_wxHyperlinkCtrl, wx.ID_ANY, _("Homepage wxGlade"), _("http://wxglade.sf.net")) sizer_20.Add(self.hyperlink_1, 0, wx.ALL, 5) self.notebook_1_wxListBox = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxListBox, _("wxListBox")) sizer_4 = wx.BoxSizer(wx.VERTICAL) self.list_box_empty = wx.ListBox(self.notebook_1_wxListBox, wx.ID_ANY, choices=[], style=0) sizer_4.Add(self.list_box_empty, 1, wx.ALL | wx.EXPAND, 5) self.list_box_filled = wx.ListBox( self.notebook_1_wxListBox, wx.ID_ANY, choices=[_("Item 1"), _("Item 2 (pre-selected)")], style=wx.LB_MULTIPLE | wx.LB_SORT) self.list_box_filled.SetSelection(1) sizer_4.Add(self.list_box_filled, 1, wx.ALL | wx.EXPAND, 5) self.notebook_1_wxListCtrl = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxListCtrl, _("wxListCtrl")) sizer_3 = wx.BoxSizer(wx.HORIZONTAL) self.list_ctrl_1 = wx.ListCtrl(self.notebook_1_wxListCtrl, wx.ID_ANY, style=wx.BORDER_SUNKEN | wx.LC_REPORT) sizer_3.Add(self.list_ctrl_1, 1, wx.ALL | wx.EXPAND, 5) self.notebook_1_wxPropertyGridManager = wx.Panel( self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxPropertyGridManager, _("wxPropertyGridManager")) sizer_34 = wx.BoxSizer(wx.HORIZONTAL) self.property_grid_2 = wx.propgrid.PropertyGridManager( self.notebook_1_wxPropertyGridManager, wx.ID_ANY, style=wx.propgrid.PG_ALPHABETIC_MODE) sizer_34.Add(self.property_grid_2, 1, wx.ALL | wx.EXPAND, 5) self.notebook_1_wxRadioBox = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxRadioBox, _("wxRadioBox")) grid_sizer_1 = wx.GridSizer(2, 2, 0, 0) self.radio_box_empty1 = wx.RadioBox(self.notebook_1_wxRadioBox, wx.ID_ANY, _("radio_box_empty1"), choices=[""], majorDimension=1, style=wx.RA_SPECIFY_ROWS) grid_sizer_1.Add(self.radio_box_empty1, 1, wx.ALL | wx.EXPAND, 5) self.radio_box_filled1 = wx.RadioBox(self.notebook_1_wxRadioBox, wx.ID_ANY, _("radio_box_filled1"), choices=[ _("choice 1"), _("choice 2 (pre-selected)"), _("choice 3") ], majorDimension=0, style=wx.RA_SPECIFY_ROWS) self.radio_box_filled1.SetSelection(1) grid_sizer_1.Add(self.radio_box_filled1, 1, wx.ALL | wx.EXPAND, 5) self.radio_box_empty2 = wx.RadioBox(self.notebook_1_wxRadioBox, wx.ID_ANY, _("radio_box_empty2"), choices=[""], majorDimension=1, style=wx.RA_SPECIFY_COLS) grid_sizer_1.Add(self.radio_box_empty2, 1, wx.ALL | wx.EXPAND, 5) self.radio_box_filled2 = wx.RadioBox( self.notebook_1_wxRadioBox, wx.ID_ANY, _("radio_box_filled2"), choices=[_("choice 1"), _("choice 2 (pre-selected)")], majorDimension=0, style=wx.RA_SPECIFY_COLS) self.radio_box_filled2.SetSelection(1) grid_sizer_1.Add(self.radio_box_filled2, 1, wx.ALL | wx.EXPAND, 5) self.notebook_1_wxRadioButton = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxRadioButton, _("wxRadioButton")) sizer_8 = wx.StaticBoxSizer( wx.StaticBox(self.notebook_1_wxRadioButton, wx.ID_ANY, _("My RadioButton Group")), wx.HORIZONTAL) grid_sizer_2 = wx.FlexGridSizer(3, 2, 0, 0) sizer_8.Add(grid_sizer_2, 1, wx.EXPAND, 0) self.radio_btn_1 = wx.RadioButton(self.notebook_1_wxRadioButton, wx.ID_ANY, _("Alice"), style=wx.RB_GROUP) grid_sizer_2.Add(self.radio_btn_1, 1, wx.ALL | wx.EXPAND, 5) self.text_ctrl_1 = wx.TextCtrl(self.notebook_1_wxRadioButton, wx.ID_ANY, "") grid_sizer_2.Add(self.text_ctrl_1, 1, wx.ALL | wx.EXPAND, 5) self.radio_btn_2 = wx.RadioButton(self.notebook_1_wxRadioButton, wx.ID_ANY, _("Bob")) grid_sizer_2.Add(self.radio_btn_2, 1, wx.ALL | wx.EXPAND, 5) self.text_ctrl_2 = wx.TextCtrl(self.notebook_1_wxRadioButton, wx.ID_ANY, "") grid_sizer_2.Add(self.text_ctrl_2, 1, wx.ALL | wx.EXPAND, 5) self.radio_btn_3 = wx.RadioButton(self.notebook_1_wxRadioButton, wx.ID_ANY, _("Malroy")) grid_sizer_2.Add(self.radio_btn_3, 1, wx.ALL | wx.EXPAND, 5) self.text_ctrl_3 = wx.TextCtrl(self.notebook_1_wxRadioButton, wx.ID_ANY, "") grid_sizer_2.Add(self.text_ctrl_3, 1, wx.ALL | wx.EXPAND, 5) self.notebook_1_wxSlider = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxSlider, _("wxSlider")) sizer_22 = wx.BoxSizer(wx.HORIZONTAL) self.slider_1 = wx.Slider(self.notebook_1_wxSlider, wx.ID_ANY, 5, 0, 10, style=0) sizer_22.Add(self.slider_1, 1, wx.ALL | wx.EXPAND, 5) self.notebook_1_wxSpinButton = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxSpinButton, _("wxSpinButton (with wxTextCtrl)")) sizer_16 = wx.BoxSizer(wx.HORIZONTAL) self.tc_spin_button = wx.TextCtrl(self.notebook_1_wxSpinButton, wx.ID_ANY, _("1"), style=wx.TE_RIGHT) sizer_16.Add(self.tc_spin_button, 1, wx.ALL, 5) self.spin_button = wx.SpinButton(self.notebook_1_wxSpinButton, wx.ID_ANY) sizer_16.Add(self.spin_button, 1, wx.ALL, 5) self.notebook_1_wxSpinCtrl = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxSpinCtrl, _("wxSpinCtrl")) sizer_14 = wx.BoxSizer(wx.HORIZONTAL) self.spin_ctrl_1 = wx.SpinCtrl(self.notebook_1_wxSpinCtrl, wx.ID_ANY, "4", min=0, max=100, style=wx.ALIGN_RIGHT | wx.SP_ARROW_KEYS) sizer_14.Add(self.spin_ctrl_1, 1, wx.ALL, 5) self.notebook_1_wxSplitterWindow_horizontal = wx.ScrolledWindow( self.notebook_1, wx.ID_ANY, style=wx.TAB_TRAVERSAL) self.notebook_1_wxSplitterWindow_horizontal.SetScrollRate(10, 10) self.notebook_1.AddPage(self.notebook_1_wxSplitterWindow_horizontal, _("wxSplitterWindow (horizontally)")) sizer_29 = wx.BoxSizer(wx.HORIZONTAL) self.splitter_1 = wx.SplitterWindow( self.notebook_1_wxSplitterWindow_horizontal, wx.ID_ANY, style=0) self.splitter_1.SetMinimumPaneSize(20) sizer_29.Add(self.splitter_1, 1, wx.ALL | wx.EXPAND, 5) self.splitter_1_pane_1 = wx.Panel(self.splitter_1, wx.ID_ANY) sizer_30 = wx.BoxSizer(wx.HORIZONTAL) self.label_top_pane = wx.StaticText(self.splitter_1_pane_1, wx.ID_ANY, _("top pane")) sizer_30.Add(self.label_top_pane, 1, wx.ALL | wx.EXPAND, 5) self.splitter_1_pane_2 = wx.Panel(self.splitter_1, wx.ID_ANY) sizer_31 = wx.BoxSizer(wx.HORIZONTAL) self.label_buttom_pane = wx.StaticText(self.splitter_1_pane_2, wx.ID_ANY, _("bottom pane")) sizer_31.Add(self.label_buttom_pane, 1, wx.ALL | wx.EXPAND, 5) self.notebook_1_wxSplitterWindow_vertical = wx.ScrolledWindow( self.notebook_1, wx.ID_ANY, style=wx.TAB_TRAVERSAL) self.notebook_1_wxSplitterWindow_vertical.SetScrollRate(10, 10) self.notebook_1.AddPage(self.notebook_1_wxSplitterWindow_vertical, _("wxSplitterWindow (vertically)")) sizer_25 = wx.BoxSizer(wx.HORIZONTAL) self.splitter_2 = wx.SplitterWindow( self.notebook_1_wxSplitterWindow_vertical, wx.ID_ANY, style=0) self.splitter_2.SetMinimumPaneSize(20) sizer_25.Add(self.splitter_2, 1, wx.ALL | wx.EXPAND, 5) self.splitter_2_pane_1 = wx.Panel(self.splitter_2, wx.ID_ANY) sizer_32 = wx.BoxSizer(wx.VERTICAL) self.label_left_pane = wx.StaticText(self.splitter_2_pane_1, wx.ID_ANY, _("left pane")) sizer_32.Add(self.label_left_pane, 1, wx.ALL | wx.EXPAND, 5) self.splitter_2_pane_2 = wx.Panel(self.splitter_2, wx.ID_ANY) sizer_33 = wx.BoxSizer(wx.VERTICAL) self.label_right_pane = wx.StaticText(self.splitter_2_pane_2, wx.ID_ANY, _("right pane")) sizer_33.Add(self.label_right_pane, 1, wx.ALL | wx.EXPAND, 5) self.notebook_1_wxStaticBitmap = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxStaticBitmap, _("wxStaticBitmap")) sizer_11 = wx.BoxSizer(wx.VERTICAL) self.bitmap_empty = wx.StaticBitmap(self.notebook_1_wxStaticBitmap, wx.ID_ANY, wx.Bitmap(32, 32)) sizer_11.Add(self.bitmap_empty, 1, wx.ALL | wx.EXPAND, 5) self.bitmap_file = wx.StaticBitmap( self.notebook_1_wxStaticBitmap, wx.ID_ANY, wx.Bitmap("icon.xpm", wx.BITMAP_TYPE_ANY)) sizer_11.Add(self.bitmap_file, 1, wx.ALL | wx.EXPAND, 5) self.bitmap_nofile = wx.StaticBitmap( self.notebook_1_wxStaticBitmap, wx.ID_ANY, wx.Bitmap("non-existing.bmp", wx.BITMAP_TYPE_ANY)) sizer_11.Add(self.bitmap_nofile, 1, wx.ALL | wx.EXPAND, 5) self.bitmap_art = wx.StaticBitmap( self.notebook_1_wxStaticBitmap, wx.ID_ANY, wx.ArtProvider.GetBitmap(wx.ART_PRINT, wx.ART_OTHER, (32, 32))) sizer_11.Add(self.bitmap_art, 1, wx.ALL | wx.EXPAND, 5) self.bitmap_null = wx.StaticBitmap(self.notebook_1_wxStaticBitmap, wx.ID_ANY, wx.NullBitmap) sizer_11.Add(self.bitmap_null, 1, wx.ALL | wx.EXPAND, 5) self.bitmap_null_sized = wx.StaticBitmap( self.notebook_1_wxStaticBitmap, wx.ID_ANY, wx.Bitmap(50, 50)) self.bitmap_null_sized.SetMinSize((50, 50)) sizer_11.Add(self.bitmap_null_sized, 1, wx.ALL | wx.EXPAND, 5) self.notebook_1_wxStaticLine = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxStaticLine, _("wxStaticLine")) sizer_9 = wx.BoxSizer(wx.VERTICAL) sizer_10 = wx.BoxSizer(wx.HORIZONTAL) sizer_9.Add(sizer_10, 1, wx.EXPAND, 0) self.static_line_2 = wx.StaticLine(self.notebook_1_wxStaticLine, wx.ID_ANY, style=wx.LI_VERTICAL) sizer_10.Add(self.static_line_2, 1, wx.ALL | wx.EXPAND, 5) self.static_line_3 = wx.StaticLine(self.notebook_1_wxStaticLine, wx.ID_ANY, style=wx.LI_VERTICAL) sizer_10.Add(self.static_line_3, 1, wx.ALL | wx.EXPAND, 5) self.static_line_4 = wx.StaticLine(self.notebook_1_wxStaticLine, wx.ID_ANY) sizer_9.Add(self.static_line_4, 1, wx.ALL | wx.EXPAND, 5) self.static_line_5 = wx.StaticLine(self.notebook_1_wxStaticLine, wx.ID_ANY) sizer_9.Add(self.static_line_5, 1, wx.ALL | wx.EXPAND, 5) self.notebook_1_wxStaticText = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxStaticText, _("wxStaticText")) grid_sizer_3 = wx.FlexGridSizer(1, 3, 0, 0) self.label_1 = wx.StaticText(self.notebook_1_wxStaticText, wx.ID_ANY, _("red text (RGB)"), style=wx.ALIGN_CENTER_HORIZONTAL) self.label_1.SetForegroundColour(wx.Colour(255, 0, 0)) grid_sizer_3.Add(self.label_1, 1, wx.ALL | wx.EXPAND, 5) self.label_4 = wx.StaticText(self.notebook_1_wxStaticText, wx.ID_ANY, _("black on red (RGB)"), style=wx.ALIGN_CENTER_HORIZONTAL) self.label_4.SetBackgroundColour(wx.Colour(255, 0, 0)) self.label_4.SetToolTip( _("Background colour won't show, check documentation for more details" )) grid_sizer_3.Add(self.label_4, 1, wx.ALL | wx.EXPAND, 5) self.label_5 = wx.StaticText(self.notebook_1_wxStaticText, wx.ID_ANY, _("green on pink (RGB)"), style=wx.ALIGN_CENTER_HORIZONTAL) self.label_5.SetBackgroundColour(wx.Colour(255, 0, 255)) self.label_5.SetForegroundColour(wx.Colour(0, 255, 0)) self.label_5.SetToolTip( _("Background colour won't show, check documentation for more details" )) grid_sizer_3.Add(self.label_5, 1, wx.ALL | wx.EXPAND, 5) self.notebook_1_Spacer = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_Spacer, _("Spacer")) grid_sizer_4 = wx.FlexGridSizer(1, 3, 0, 0) self.label_3 = wx.StaticText(self.notebook_1_Spacer, wx.ID_ANY, _("Two labels with a")) grid_sizer_4.Add(self.label_3, 1, wx.ALL | wx.EXPAND, 5) grid_sizer_4.Add((60, 20), 1, wx.ALL | wx.EXPAND, 5) self.label_2 = wx.StaticText(self.notebook_1_Spacer, wx.ID_ANY, _("spacer between")) grid_sizer_4.Add(self.label_2, 1, wx.ALL | wx.EXPAND, 5) self.notebook_1_wxTextCtrl = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxTextCtrl, _("wxTextCtrl")) sizer_18 = wx.BoxSizer(wx.HORIZONTAL) self.text_ctrl = wx.TextCtrl(self.notebook_1_wxTextCtrl, wx.ID_ANY, _("This\nis\na\nmultiline\nwxTextCtrl"), style=wx.TE_CHARWRAP | wx.TE_MULTILINE | wx.TE_WORDWRAP) sizer_18.Add(self.text_ctrl, 1, wx.ALL | wx.EXPAND, 5) self.notebook_1_wxToggleButton = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxToggleButton, _("wxToggleButton")) sizer_23 = wx.BoxSizer(wx.HORIZONTAL) self.button_2 = wx.ToggleButton(self.notebook_1_wxToggleButton, wx.ID_ANY, _("Toggle Button 1")) sizer_23.Add(self.button_2, 1, wx.ALL, 5) self.button_4 = wx.ToggleButton(self.notebook_1_wxToggleButton, wx.ID_ANY, _("Toggle Button 2"), style=wx.BU_BOTTOM | wx.BU_EXACTFIT) sizer_23.Add(self.button_4, 1, wx.ALL, 5) self.notebook_1_wxTreeCtrl = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_wxTreeCtrl, _("wxTreeCtrl")) sizer_24 = wx.BoxSizer(wx.HORIZONTAL) self.tree_ctrl_1 = wx.TreeCtrl(self.notebook_1_wxTreeCtrl, wx.ID_ANY, style=0) sizer_24.Add(self.tree_ctrl_1, 1, wx.ALL | wx.EXPAND, 5) self.static_line_1 = wx.StaticLine(self, wx.ID_ANY) sizer_1.Add(self.static_line_1, 0, wx.ALL | wx.EXPAND, 5) sizer_2 = wx.FlexGridSizer(1, 2, 0, 0) sizer_1.Add(sizer_2, 0, wx.ALIGN_RIGHT, 0) self.button_5 = wx.Button(self, wx.ID_CLOSE, "") sizer_2.Add(self.button_5, 0, wx.ALIGN_RIGHT | wx.ALL, 5) self.button_1 = wx.Button(self, wx.ID_OK, "", style=wx.BU_TOP) sizer_2.Add(self.button_1, 0, wx.ALIGN_RIGHT | wx.ALL, 5) self.notebook_1_wxTreeCtrl.SetSizer(sizer_24) self.notebook_1_wxToggleButton.SetSizer(sizer_23) self.notebook_1_wxTextCtrl.SetSizer(sizer_18) self.notebook_1_Spacer.SetSizer(grid_sizer_4) self.notebook_1_wxStaticText.SetSizer(grid_sizer_3) self.notebook_1_wxStaticLine.SetSizer(sizer_9) self.notebook_1_wxStaticBitmap.SetSizer(sizer_11) self.splitter_2_pane_2.SetSizer(sizer_33) self.splitter_2_pane_1.SetSizer(sizer_32) self.splitter_2.SplitVertically(self.splitter_2_pane_1, self.splitter_2_pane_2) self.notebook_1_wxSplitterWindow_vertical.SetSizer(sizer_25) self.splitter_1_pane_2.SetSizer(sizer_31) self.splitter_1_pane_1.SetSizer(sizer_30) self.splitter_1.SplitHorizontally(self.splitter_1_pane_1, self.splitter_1_pane_2) self.notebook_1_wxSplitterWindow_horizontal.SetSizer(sizer_29) self.notebook_1_wxSpinCtrl.SetSizer(sizer_14) self.notebook_1_wxSpinButton.SetSizer(sizer_16) self.notebook_1_wxSlider.SetSizer(sizer_22) self.notebook_1_wxRadioButton.SetSizer(sizer_8) self.notebook_1_wxRadioBox.SetSizer(grid_sizer_1) self.notebook_1_wxPropertyGridManager.SetSizer(sizer_34) self.notebook_1_wxListCtrl.SetSizer(sizer_3) self.notebook_1_wxListBox.SetSizer(sizer_4) self.notebook_1_wxHyperlinkCtrl.SetSizer(sizer_20) self.notebook_1_wxGrid.SetSizer(sizer_19) self.notebook_1_wxGauge.SetSizer(sizer_15) self.notebook_1_wxDatePickerCtrl.SetSizer(sizer_17) self.notebook_1_wxComboBox.SetSizer(sizer_6) self.notebook_1_wxChoice.SetSizer(sizer_5) self.notebook_1_wxCheckListBox.SetSizer(sizer_26) self.notebook_1_wxCheckBox.SetSizer(sizer_21) self.notebook_1_wxGenericCalendarCtrl.SetSizer(sizer_27) self.notebook_1_wxCalendarCtrl.SetSizer(sizer_12) self.notebook_1_wxButton.SetSizer(sizer_28) sizer_13.AddGrowableRow(0) sizer_13.AddGrowableRow(1) sizer_13.AddGrowableCol(0) sizer_13.AddGrowableCol(1) self.notebook_1_wxBitmapButton.SetSizer(sizer_13) sizer_1.AddGrowableRow(0) sizer_1.AddGrowableCol(0) self.SetSizer(sizer_1) sizer_1.SetSizeHints(self) self.Layout() self.Centre() self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.OnNotebookPageChanged, self.notebook_1) self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGING, self.OnNotebookPageChanging, self.notebook_1) self.Bind(wx.EVT_NAVIGATION_KEY, self.OnBitmapButtonPanelNavigationKey) self.Bind(wx.EVT_BUTTON, self.onStartConverting, self.button_1)
def __init__(self, parent, OS): """ The first item of the self.info is a complete list of all informations getting by extract_info method from youtube_dl module. The second item can be a status error witch sets the self.error attribute. """ self.parent = parent self.OS = OS self.info = [] self.error = False wx.Panel.__init__(self, parent, -1) """constructor""" sizer_base = wx.BoxSizer(wx.VERTICAL) frame = wx.StaticBoxSizer(wx.StaticBox(self, wx.ID_ANY, ("")), wx.VERTICAL) sizer_base.Add(frame, 1, wx.ALL | wx.EXPAND, 5) sizer = wx.BoxSizer(wx.VERTICAL) frame.Add(sizer, 1, wx.ALL | wx.EXPAND, 5) self.choice = wx.Choice( self, wx.ID_ANY, choices=[ _('Default'), _('Separated Video+Audio'), _('Audio only'), _('By using format code') ], size=(-1, -1), ) self.choice.SetSelection(0) sizer.Add(self.choice, 0, wx.EXPAND | wx.ALL, 15) grid_v = wx.FlexGridSizer(1, 7, 0, 0) sizer.Add(grid_v, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) f = [x for x in vquality.keys()] self.cmbx_vq = wx.ComboBox(self, wx.ID_ANY, choices=f, size=(150, -1), style=wx.CB_DROPDOWN | wx.CB_READONLY) self.cmbx_vq.SetSelection(0) #grid_v.Add((20, 20), 0,) grid_v.Add(self.cmbx_vq, 0, wx.ALL, 5) self.cmbx_aq = wx.ComboBox(self, wx.ID_ANY, choices=[x for x in aquality.keys()], size=(150, -1), style=wx.CB_DROPDOWN | wx.CB_READONLY) self.cmbx_aq.SetSelection(0) self.cmbx_aq.Disable() #grid_v.Add((20, 20), 0,) grid_v.Add(self.cmbx_aq, 0, wx.ALL, 5) self.cmbx_af = wx.ComboBox(self, wx.ID_ANY, choices=[x for x in aformats.keys()], size=(150, -1), style=wx.CB_DROPDOWN | wx.CB_READONLY) self.cmbx_af.Disable() self.cmbx_af.SetSelection(0) grid_v.Add(self.cmbx_af, 0, wx.ALL, 5) self.txt_code = wx.TextCtrl(self, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER, size=(50, -1)) self.txt_code.Disable() self.stext = wx.StaticText(self, wx.ID_ANY, (_('Enter Format Code here:'))) self.stext.Disable() grid_v.Add(self.stext, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) grid_v.Add(self.txt_code, 0, wx.ALL, 5) #-------------opt grid_opt = wx.FlexGridSizer(1, 4, 0, 0) sizer.Add(grid_opt, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) self.ckbx_pl = wx.CheckBox(self, wx.ID_ANY, (_('Download all playlist'))) grid_opt.Add(self.ckbx_pl, 0, wx.ALL, 5) self.ckbx_thumb = wx.CheckBox(self, wx.ID_ANY, (_('Embed thumbnail in audio file'))) grid_opt.Add(self.ckbx_thumb, 0, wx.ALL, 5) self.ckbx_meta = wx.CheckBox(self, wx.ID_ANY, (_('Add metadata to file'))) grid_opt.Add(self.ckbx_meta, 0, wx.ALL, 5) self.ckbx_sb = wx.CheckBox(self, wx.ID_ANY, (_('Write subtitles to video'))) grid_opt.Add(self.ckbx_sb, 0, wx.ALL, 5) line_1 = wx.StaticLine(self, pos=(25, 50), size=(650, 0)) sizer.Add(line_1, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 10) self.fcode = wx.ListCtrl(self, wx.ID_ANY, style=wx.LC_REPORT | wx.SUNKEN_BORDER) sizer.Add(self.fcode, 1, wx.EXPAND | wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 10) self.fcode.InsertColumn(0, (_('TITLE')), width=180) self.fcode.InsertColumn(1, (_('URL')), width=80) self.fcode.InsertColumn(2, (_('Format Code')), width=100) self.fcode.InsertColumn(3, (_('Extension')), width=80) self.fcode.InsertColumn(4, (_('Resolution')), width=140) self.fcode.InsertColumn(5, (_('Video Codec')), width=110) self.fcode.InsertColumn(6, (_('fps')), width=60) self.fcode.InsertColumn(7, (_('Audio Codec')), width=110) self.fcode.InsertColumn(8, (_('Size')), width=80) self.fcode.Hide() if OS == 'Darwin': self.fcode.SetFont(wx.Font(12, wx.MODERN, wx.NORMAL, wx.NORMAL)) else: self.fcode.SetFont(wx.Font(9, wx.MODERN, wx.NORMAL, wx.NORMAL)) self.SetSizer(sizer_base) self.Layout() #----------------------Binder (EVT)----------------------# self.choice.Bind(wx.EVT_CHOICE, self.on_Choice) self.cmbx_vq.Bind(wx.EVT_COMBOBOX, self.on_Vq) self.cmbx_af.Bind(wx.EVT_COMBOBOX, self.on_Af) self.cmbx_aq.Bind(wx.EVT_COMBOBOX, self.on_Aq) self.ckbx_pl.Bind(wx.EVT_CHECKBOX, self.on_Playlist) self.ckbx_thumb.Bind(wx.EVT_CHECKBOX, self.on_Thumbnails) self.ckbx_meta.Bind(wx.EVT_CHECKBOX, self.on_Metadata) self.ckbx_sb.Bind(wx.EVT_CHECKBOX, self.on_Subtitles)
def _createNonHeaderWidgets(self): self.dataLabel = wx.StaticText(self, wx.ID_ANY, self.label) self.dataWidget = self._createDataWidget() self.staticLine = wx.StaticLine(self)
def __init__(self, parent, title): super().__init__(parent, title=title, size=(600, 450)) self.sb = self.CreateStatusBar() self.sb.SetStatusText("Текст в статусной строке") panel = wx.Panel(self) vbox = wx.BoxSizer(wx.VERTICAL) st = wx.StaticText(panel, label="Адрес: ") vbox.Add(st, flag=wx.ALL, border=10) inp = wx.TextCtrl(panel, value="г. Москва") vbox.Add(inp, flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, border=10) vbox.Add(wx.StaticLine(panel), flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=10) rtb = wx.ToggleButton(panel, id=B_RED, label='red', pos=(20, 25)) gtb = wx.ToggleButton(panel, id=B_GREEN, label='green', pos=(20, 60)) btb = wx.ToggleButton(panel, id=B_BLUE, label='blue', pos=(20, 100)) self.col = wx.Colour(0, 0, 0) self.pn = wx.Panel(panel) self.pn.SetBackgroundColour(self.col.GetAsString()) vb1 = wx.GridBagSizer(10, 10) vb1.Add(rtb, (0, 0)) vb1.Add(gtb, (1, 0)) vb1.Add(btb, (2, 0)) vb1.Add(self.pn, (0, 1), (3, 1), flag=wx.EXPAND) vb1.AddGrowableCol(1) vbox.Add(vb1, flag=wx.EXPAND | wx.ALL, border=10) vbox.Add(wx.StaticLine(panel), flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=10) rtb.Bind(wx.EVT_TOGGLEBUTTON, self.onToggle) gtb.Bind(wx.EVT_TOGGLEBUTTON, self.onToggle) btb.Bind(wx.EVT_TOGGLEBUTTON, self.onToggle) pn2 = wx.Panel(panel) wx.StaticBox(pn2, label="Ваш пол:", size=(150, 50)) rd1 = wx.RadioButton(pn2, label="Муж", pos=(10, 20), style=wx.RB_GROUP) rd2 = wx.RadioButton(pn2, label="Жен", pos=(100, 20)) vb2 = wx.BoxSizer(wx.HORIZONTAL) vb2.Add(pn2) agree = wx.CheckBox(panel, label="Согласен на обработку") agree.SetValue(True) vb2.Add(agree, flag=wx.LEFT | wx.TOP, border=20) links = ["Телефон", "E-mail", "Skype"] cb = wx.ComboBox(panel, pos=(50, 30), choices=links, style=wx.CB_READONLY) cb.SetSelection(0) vb2.Add(cb, flag=wx.LEFT | wx.TOP, border=15) sc = wx.SpinCtrl(panel, value='0', min=-100, max=100) vb2.Add(sc, flag=wx.LEFT | wx.TOP, border=15) vbox.Add(vb2, flag=wx.EXPAND | wx.ALL, border=10) self.gauge = wx.Gauge(panel, range=100) vbox.Add(self.gauge, flag=wx.EXPAND | wx.ALL, border=10) bStart = wx.Button(panel, label="Старт") bStop = wx.Button(panel, label="Стоп") hb3 = wx.BoxSizer() hb3.AddMany([(bStart, 0, wx.LEFT | wx.RIGHT, 10), (bStop, 0, wx.LEFT | wx.RIGHT | wx.BOTTOM, 10)]) vbox.Add(hb3, flag=wx.ALIGN_CENTRE) vbox.Add(wx.StaticLine(panel), flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=10) sld = wx.Slider(panel, value=200, minValue=150, maxValue=500, style=wx.SL_HORIZONTAL) vbox.Add(sld, flag=wx.EXPAND | wx.ALL, border=10) panel.SetSizer(vbox) bStart.Bind(wx.EVT_BUTTON, self.onStart) bStop.Bind(wx.EVT_BUTTON, self.onStop) sld.Bind(wx.EVT_SCROLL, self.OnSliderScroll) self.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.OnTimer, self.timer) self.count = 0 self.gauge.SetValue(self.count)
def __init__(self, parent, stuff, item, items, context=None): wx.Panel.__init__(self, parent) mainSizer = wx.BoxSizer(wx.VERTICAL) self.paramList = AutoListCtrl(self, wx.ID_ANY, style= # wx.LC_HRULES | # wx.LC_NO_HEADER | wx.LC_REPORT | wx.LC_SINGLE_SEL | wx.LC_VRULES | wx.NO_BORDER) mainSizer.Add(self.paramList, 1, wx.ALL | wx.EXPAND, 0) self.SetSizer(mainSizer) self.toggleView = 1 self.stuff = stuff self.item = item self.items = sorted(items, key=lambda x: x.attributes['metaLevel'].value if 'metaLevel' in x.attributes else None) self.attrs = {} # get a dict of attrName: attrInfo of all unique attributes across all items for item in self.items: for attr in item.attributes.keys(): if item.attributes[attr].info.displayName: self.attrs[attr] = item.attributes[attr].info # Process attributes for items and find ones that differ for attr in self.attrs.keys(): value = None for item in self.items: # we can automatically break here if this item doesn't have the attribute, # as that means at least one item did if attr not in item.attributes: break # this is the first attribute for the item set, set the initial value if value is None: value = item.attributes[attr].value continue if attr not in item.attributes or item.attributes[attr].value != value: break else: # attribute values were all the same, delete del self.attrs[attr] self.m_staticline = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) mainSizer.Add(self.m_staticline, 0, wx.EXPAND) bSizer = wx.BoxSizer(wx.HORIZONTAL) self.totalAttrsLabel = wx.StaticText(self, wx.ID_ANY, u" ", wx.DefaultPosition, wx.DefaultSize, 0) bSizer.Add(self.totalAttrsLabel, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT) self.toggleViewBtn = wx.ToggleButton(self, wx.ID_ANY, u"Toggle view mode", wx.DefaultPosition, wx.DefaultSize, 0) bSizer.Add(self.toggleViewBtn, 0, wx.ALIGN_CENTER_VERTICAL) if stuff is not None: self.refreshBtn = wx.Button(self, wx.ID_ANY, u"Refresh", wx.DefaultPosition, wx.DefaultSize, wx.BU_EXACTFIT) bSizer.Add(self.refreshBtn, 0, wx.ALIGN_CENTER_VERTICAL) self.refreshBtn.Bind(wx.EVT_BUTTON, self.RefreshValues) mainSizer.Add(bSizer, 0, wx.ALIGN_RIGHT) self.PopulateList() self.toggleViewBtn.Bind(wx.EVT_TOGGLEBUTTON, self.ToggleViewMode)
def InitUI(self): panel = wx.Panel(self) sizer = wx.GridBagSizer(5, 5) text1 = wx.StaticText(panel, label="CHI CỤC THUẾ GÒ VẤP") sizer.Add(text1, pos=(0, 0), flag=wx.TOP | wx.LEFT | wx.BOTTOM, border=15) icon = wx.StaticBitmap(panel, bitmap=wx.Bitmap('thue.jpg')) sizer.Add(icon, pos=(0, 4), flag=wx.TOP | wx.RIGHT | wx.ALIGN_RIGHT, border=5) line = wx.StaticLine(panel) sizer.Add(line, pos=(1, 0), span=(1, 5), flag=wx.EXPAND | wx.BOTTOM, border=10) text2 = wx.StaticText(panel, label="Năm") sizer.Add(text2, pos=(2, 0), flag=wx.LEFT, border=10) tc1 = wx.TextCtrl(panel) sizer.Add(tc1, pos=(2, 1), span=(1, 3), flag=wx.TOP | wx.EXPAND) text3 = wx.StaticText(panel, label="File Nhập") sizer.Add(text3, pos=(3, 0), flag=wx.LEFT | wx.TOP, border=10) tc2 = wx.TextCtrl(panel) sizer.Add(tc2, pos=(3, 1), span=(1, 3), flag=wx.TOP | wx.EXPAND, border=5) button1 = wx.Button(panel, label="Browse...") sizer.Add(button1, pos=(3, 4), flag=wx.TOP | wx.RIGHT, border=5) text4 = wx.StaticText(panel, label="File Xuất") sizer.Add(text4, pos=(4, 0), flag=wx.TOP | wx.LEFT, border=10) combo = wx.ComboBox(panel) sizer.Add(combo, pos=(4, 1), span=(1, 3), flag=wx.TOP | wx.EXPAND, border=5) button2 = wx.Button(panel, label="Browse...") sizer.Add(button2, pos=(4, 4), flag=wx.TOP | wx.RIGHT, border=5) sb = wx.StaticBox(panel, label="Nâng Cao") boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) boxsizer.Add(wx.CheckBox(panel, label="Xuất Tất Cả"), flag=wx.LEFT | wx.TOP, border=5) boxsizer.Add(wx.CheckBox(panel, label="Xuất hồ sơ thành công"), flag=wx.LEFT, border=5) boxsizer.Add(wx.CheckBox(panel, label="Xuất hồ sơ hoàn"), flag=wx.LEFT | wx.BOTTOM, border=5) sizer.Add(boxsizer, pos=(5, 0), span=(1, 5), flag=wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, border=10) button3 = wx.Button(panel, label='Help') sizer.Add(button3, pos=(7, 0), flag=wx.LEFT, border=10) button4 = wx.Button(panel, label="Ok") sizer.Add(button4, pos=(7, 3)) button4.Bind(wx.EVT_BUTTON, self.OnClicked) button5 = wx.Button(panel, label="Cancel") sizer.Add(button5, pos=(7, 4), span=(1, 1), flag=wx.BOTTOM | wx.RIGHT, border=10) sizer.AddGrowableCol(2) panel.SetSizer(sizer) sizer.Fit(self)
def _init_ui(self): self.main_sizer = wx.BoxSizer(wx.VERTICAL) self.main_sizer.Add(GenericBitmapButton(self, 'tool_color')) self.color_indicator = wx.StaticLine(self, size=(-1, 2)) self.main_sizer.Add(self.color_indicator, flag=wx.EXPAND) self.SetSizer(self.main_sizer)
def __init__(self, parent, gui_size, cfg): """Constructor""" wx.Panel.__init__(self, parent=parent) # variable initialization self.config = cfg self.bodyparts = [] # design the panel self.sizer = wx.GridBagSizer(5, 5) text = wx.StaticText(self, label="DeepLabCut - Step 6. Evaluate Network") self.sizer.Add(text, pos=(0, 0), flag=wx.TOP | wx.LEFT | wx.BOTTOM, border=15) # Add logo of DLC icon = wx.StaticBitmap(self, bitmap=wx.Bitmap(LOGO_PATH)) self.sizer.Add(icon, pos=(0, 4), flag=wx.TOP | wx.RIGHT | wx.ALIGN_RIGHT, border=5) line1 = wx.StaticLine(self) self.sizer.Add(line1, pos=(1, 0), span=(1, 5), flag=wx.EXPAND | wx.BOTTOM, border=10) self.cfg_text = wx.StaticText(self, label="Select the config file") self.sizer.Add(self.cfg_text, pos=(2, 0), flag=wx.TOP | wx.LEFT, border=5) if sys.platform == "darwin": self.sel_config = wx.FilePickerCtrl( self, path="", style=wx.FLP_USE_TEXTCTRL, message="Choose the config.yaml file", wildcard="*.yaml", ) else: self.sel_config = wx.FilePickerCtrl( self, path="", style=wx.FLP_USE_TEXTCTRL, message="Choose the config.yaml file", wildcard="config.yaml", ) # self.sel_config = wx.FilePickerCtrl(self, path="",style=wx.FLP_USE_TEXTCTRL,message="Choose the config.yaml file", wildcard="config.yaml") self.sizer.Add(self.sel_config, pos=(2, 1), span=(1, 3), flag=wx.TOP | wx.EXPAND, border=5) self.sel_config.SetPath(self.config) self.sel_config.Bind(wx.EVT_FILEPICKER_CHANGED, self.select_config) sb = wx.StaticBox(self, label="Attributes") boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) self.hbox1 = wx.BoxSizer(wx.HORIZONTAL) self.hbox2 = wx.BoxSizer(wx.HORIZONTAL) self.hbox3 = wx.BoxSizer(wx.HORIZONTAL) config_file = auxiliaryfunctions.read_config(self.config) shuffles_text = wx.StaticBox(self, label="Specify the shuffle") shuffles_text_boxsizer = wx.StaticBoxSizer(shuffles_text, wx.VERTICAL) self.shuffles = wx.SpinCtrl(self, value="1", min=0, max=100) shuffles_text_boxsizer.Add(self.shuffles, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 10) #trainingset = wx.StaticBox(self, label="Specify the trainingset index") #trainingset_boxsizer = wx.StaticBoxSizer(trainingset, wx.VERTICAL) #self.trainingset = wx.SpinCtrl(self, value="0", min=0, max=100) #trainingset_boxsizer.Add( # self.trainingset, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 10 #) self.plot_choice = wx.RadioBox( self, label="Want to plot predictions (as in standard DLC projects)?", choices=["Yes", "No"], majorDimension=1, style=wx.RA_SPECIFY_COLS, ) self.plot_choice.SetSelection(0) self.plot_scoremaps = wx.RadioBox( self, label="Want to plot maps (ALL images): scoremaps, PAFs, locrefs?", choices=["Yes", "No"], majorDimension=1, style=wx.RA_SPECIFY_COLS, ) self.plot_scoremaps.SetSelection(1) self.bodypart_choice = wx.RadioBox( self, label="Compare all bodyparts?", choices=["Yes", "No"], majorDimension=1, style=wx.RA_SPECIFY_COLS, ) self.bodypart_choice.Bind(wx.EVT_RADIOBOX, self.chooseOption) if config_file.get("multianimalproject", False): bodyparts = config_file["multianimalbodyparts"] else: bodyparts = config_file["bodyparts"] self.bodyparts_to_compare = wx.CheckListBox( self, choices=bodyparts, style=0, name="Select the bodyparts") self.bodyparts_to_compare.Bind(wx.EVT_CHECKLISTBOX, self.getbp) self.bodyparts_to_compare.Hide() self.hbox1.Add(shuffles_text_boxsizer, 5, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) #self.hbox1.Add(trainingset_boxsizer, 5, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) self.hbox1.Add(self.plot_scoremaps, 5, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) self.hbox2.Add(self.plot_choice, 5, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) self.hbox2.Add(self.bodypart_choice, 5, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) self.hbox2.Add(self.bodyparts_to_compare, 10, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) boxsizer.Add(self.hbox1, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 10) boxsizer.Add(self.hbox2, 5, wx.EXPAND | wx.TOP | wx.BOTTOM, 10) self.sizer.Add( boxsizer, pos=(3, 0), span=(1, 5), flag=wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, border=10, ) self.help_button = wx.Button(self, label="Help") self.sizer.Add(self.help_button, pos=(4, 0), flag=wx.LEFT, border=10) self.help_button.Bind(wx.EVT_BUTTON, self.help_function) self.ok = wx.Button(self, label="RUN: Evaluate Network") self.sizer.Add(self.ok, pos=(4, 3)) self.ok.Bind(wx.EVT_BUTTON, self.evaluate_network) self.ok = wx.Button(self, label="Optional: Plot 3 test maps") self.sizer.Add(self.ok, pos=(5, 3)) self.ok.Bind(wx.EVT_BUTTON, self.plot_maps) self.cancel = wx.Button(self, label="Reset") self.sizer.Add(self.cancel, pos=(4, 1), span=(1, 1), flag=wx.BOTTOM | wx.RIGHT, border=10) self.cancel.Bind(wx.EVT_BUTTON, self.cancel_evaluate_network) if config_file.get("multianimalproject", False): self.inf_cfg_text = wx.Button( self, label="Edit the inference_config.yaml") self.inf_cfg_text.Bind(wx.EVT_BUTTON, self.edit_inf_config) self.sizer.Add( self.inf_cfg_text, pos=(4, 2), span=(1, 1), flag=wx.BOTTOM | wx.RIGHT, border=10, ) self.sizer.AddGrowableCol(2) self.SetSizer(self.sizer) self.sizer.Fit(self)
def __init__(self, parent, gui_size, cfg): """Constructor""" wx.Panel.__init__(self, parent=parent) # variable initilization self.method = "automatic" self.config = cfg # design the panel self.sizer = wx.GridBagSizer(5, 5) text = wx.StaticText(self, label="DeepLabCut - Step 5. Train network") self.sizer.Add(text, pos=(0, 0), flag=wx.TOP | wx.LEFT | wx.BOTTOM, border=15) # Add logo of DLC icon = wx.StaticBitmap(self, bitmap=wx.Bitmap(LOGO_PATH)) self.sizer.Add(icon, pos=(0, 4), flag=wx.TOP | wx.RIGHT | wx.ALIGN_RIGHT, border=5) line1 = wx.StaticLine(self) self.sizer.Add(line1, pos=(1, 0), span=(1, 5), flag=wx.EXPAND | wx.BOTTOM, border=10) self.cfg_text = wx.StaticText(self, label="Select the config file") self.sizer.Add(self.cfg_text, pos=(2, 0), flag=wx.TOP | wx.LEFT, border=5) if sys.platform == "darwin": self.sel_config = wx.FilePickerCtrl( self, path="", style=wx.FLP_USE_TEXTCTRL, message="Choose the config.yaml file", wildcard="*.yaml", ) else: self.sel_config = wx.FilePickerCtrl( self, path="", style=wx.FLP_USE_TEXTCTRL, message="Choose the config.yaml file", wildcard="config.yaml", ) # self.sel_config = wx.FilePickerCtrl(self, path="",style=wx.FLP_USE_TEXTCTRL,message="Choose the config.yaml file", wildcard="config.yaml") self.sizer.Add(self.sel_config, pos=(2, 1), span=(1, 3), flag=wx.TOP | wx.EXPAND, border=5) self.sel_config.SetPath(self.config) self.sel_config.Bind(wx.EVT_FILEPICKER_CHANGED, self.select_config) vbox1 = wx.BoxSizer(wx.VERTICAL) self.pose_cfg_text = wx.Button( self, label="Click to open the pose config file") self.pose_cfg_text.Bind(wx.EVT_BUTTON, self.edit_pose_config) vbox1.Add(self.pose_cfg_text, 10, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) self.update_params_text = wx.Button(self, label="Update the parameters") self.update_params_text.Bind(wx.EVT_BUTTON, self.update_params) vbox1.Add(self.update_params_text, 10, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) self.pose_cfg_text.Hide() self.update_params_text.Hide() sb = wx.StaticBox(self, label="Optional Attributes") boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL) hbox1 = wx.BoxSizer(wx.HORIZONTAL) hbox2 = wx.BoxSizer(wx.HORIZONTAL) shuffles_text = wx.StaticBox(self, label="Specify the shuffle") shuffles_text_boxsizer = wx.StaticBoxSizer(shuffles_text, wx.VERTICAL) self.shuffles = wx.SpinCtrl(self, value="1", min=0, max=100) shuffles_text_boxsizer.Add(self.shuffles, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 10) #trainingindex = wx.StaticBox(self, label="Specify the trainingset index") #trainingindex_boxsizer = wx.StaticBoxSizer(trainingindex, wx.VERTICAL) #self.trainingindex = wx.SpinCtrl(self, value="0", min=0, max=100) #trainingindex_boxsizer.Add( # self.trainingindex, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 10) self.pose_cfg_choice = wx.RadioBox( self, label="Want to edit pose_cfg.yaml file?", choices=["Yes", "No"], majorDimension=1, style=wx.RA_SPECIFY_COLS, ) self.pose_cfg_choice.Bind(wx.EVT_RADIOBOX, self.chooseOption) self.pose_cfg_choice.SetSelection(1) # use the default pose_cfg file for default values default_pose_cfg_path = os.path.join( Path(deeplabcut.__file__).parent, "pose_cfg.yaml") pose_cfg = auxiliaryfunctions.read_plainconfig(default_pose_cfg_path) display_iters = str(pose_cfg["display_iters"]) save_iters = str(pose_cfg["save_iters"]) max_iters = str(pose_cfg["multi_step"][-1][-1]) display_iters_text = wx.StaticBox(self, label="Display iterations") display_iters_text_boxsizer = wx.StaticBoxSizer( display_iters_text, wx.VERTICAL) self.display_iters = wx.SpinCtrl(self, value=display_iters, min=1, max=int(max_iters)) display_iters_text_boxsizer.Add(self.display_iters, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 10) # self.display_iters.Enable(False) save_iters_text = wx.StaticBox(self, label="Save X number of iterations") save_iters_text_boxsizer = wx.StaticBoxSizer(save_iters_text, wx.VERTICAL) self.save_iters = wx.SpinCtrl(self, value="10000", min=1, max=int(max_iters)) save_iters_text_boxsizer.Add(self.save_iters, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 10) # self.save_iters.Enable(False) max_iters_text = wx.StaticBox(self, label="Maximum iterations") max_iters_text_boxsizer = wx.StaticBoxSizer(max_iters_text, wx.VERTICAL) self.max_iters = wx.SpinCtrl(self, value="500000", min=1, max=int(max_iters)) max_iters_text_boxsizer.Add(self.max_iters, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 10) # self.max_iters.Enable(False) snapshots = wx.StaticBox(self, label="Number of network snapshots to keep") snapshots_boxsizer = wx.StaticBoxSizer(snapshots, wx.VERTICAL) self.snapshots = wx.SpinCtrl(self, value="10", min=1, max=100) snapshots_boxsizer.Add(self.snapshots, 1, wx.EXPAND | wx.TOP | wx.BOTTOM, 10) # self.snapshots.Enable(False) hbox1.Add(shuffles_text_boxsizer, 10, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) #hbox1.Add(trainingindex_boxsizer, 10, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) hbox1.Add(self.pose_cfg_choice, 10, wx.EXPAND | wx.TOP | wx.BOTTOM, 10) hbox1.Add(vbox1, 10, wx.EXPAND | wx.TOP | wx.BOTTOM, 10) hbox2.Add(display_iters_text_boxsizer, 10, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) hbox2.Add(save_iters_text_boxsizer, 10, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) hbox2.Add(max_iters_text_boxsizer, 10, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) hbox2.Add(snapshots_boxsizer, 10, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) boxsizer.Add(hbox1, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 10) boxsizer.Add(hbox2, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 10) self.sizer.Add( boxsizer, pos=(4, 0), span=(1, 5), flag=wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, border=10, ) self.help_button = wx.Button(self, label="Help") self.sizer.Add(self.help_button, pos=(5, 0), flag=wx.LEFT, border=10) self.help_button.Bind(wx.EVT_BUTTON, self.help_function) self.ok = wx.Button(self, label="Ok") self.sizer.Add(self.ok, pos=(5, 4)) self.ok.Bind(wx.EVT_BUTTON, self.train_network) self.cancel = wx.Button(self, label="Reset") self.sizer.Add(self.cancel, pos=(5, 1), span=(1, 1), flag=wx.BOTTOM | wx.RIGHT, border=10) self.cancel.Bind(wx.EVT_BUTTON, self.cancel_train_network) self.sizer.AddGrowableCol(2) self.SetSizer(self.sizer) self.sizer.Fit(self)
def __init__(self, ui, parent, allow_buttons): """ Initializes the object. """ self.ui = ui history = None view = ui.view title = view.title # Reset any existing history listeners: history = ui.history if history is not None: history.on_trait_change(self._on_undoable, 'undoable', remove=True) history.on_trait_change(self._on_redoable, 'redoable', remove=True) history.on_trait_change(self._on_revertable, 'undoable', remove=True) # Determine if we need any buttons or an 'undo' history: buttons = [self.coerce_button(button) for button in view.buttons] nbuttons = len(buttons) if nbuttons == 0: if view.undo: self.check_button(buttons, UndoButton) if view.revert: self.check_button(buttons, RevertButton) if view.help: self.check_button(buttons, HelpButton) if allow_buttons and (history is None): for button in buttons: if (self.is_button(button, 'Undo') or self.is_button(button, 'Revert')): history = UndoHistory() break ui.history = history # Create a container panel to put everything in: cpanel = getattr(self, 'control', None) if cpanel is not None: cpanel.SetSizer(None) cpanel.DestroyChildren() else: self.control = cpanel = TraitsUIPanel(parent, -1) # Create the actual trait sheet panel and embed it in a scrollable # window (if requested): sw_sizer = wx.BoxSizer(wx.VERTICAL) if ui.scrollable: sizer = wx.BoxSizer(wx.VERTICAL) sw = TraitsUIScrolledPanel(cpanel) sizer.Add(panel(ui, sw), 1, wx.EXPAND) sw.SetSizerAndFit(sizer) sw.SetScrollRate(16, 16) else: sw = panel(ui, cpanel) if ((title != '') and (not isinstance(getattr(parent, 'owner', None), DockWindow))): sw_sizer.Add( heading_text(cpanel, text=title).control, 0, wx.EXPAND) self.add_toolbar(sw_sizer) sw_sizer.Add(sw, 1, wx.EXPAND) if (allow_buttons and ((nbuttons != 1) or (not self.is_button(buttons[0], '')))): # Add the special function buttons: sw_sizer.Add(wx.StaticLine(cpanel, -1), 0, wx.EXPAND) b_sizer = wx.BoxSizer(wx.HORIZONTAL) for button in buttons: if self.is_button(button, 'Undo'): self.undo = self.add_button(button, b_sizer, self._on_undo, False) self.redo = self.add_button(button, b_sizer, self._on_redo, False, 'Redo') history.on_trait_change(self._on_undoable, 'undoable', dispatch='ui') history.on_trait_change(self._on_redoable, 'redoable', dispatch='ui') elif self.is_button(button, 'Revert'): self.revert = self.add_button(button, b_sizer, self._on_revert, False) history.on_trait_change(self._on_revertable, 'undoable', dispatch='ui') elif self.is_button(button, 'Help'): self.add_button(button, b_sizer, self._on_help) elif not self.is_button(button, ''): self.add_button(button, b_sizer) sw_sizer.Add(b_sizer, 0, wx.ALIGN_RIGHT | wx.ALL, 5) cpanel.SetSizerAndFit(sw_sizer)
def __init__(self, *args, **kwds): # begin wxGlade: PyOgg2_MyFrame.__init__ kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.SetSize((600, 500)) self.SetTitle(_("mp3 2 ogg")) # Menu Bar self.Mp3_To_Ogg_menubar = wx.MenuBar() wxglade_tmp_menu = wx.Menu() wxglade_tmp_menu.Append(wx.ID_OPEN, _("&Open"), "") self.Bind(wx.EVT_MENU, self.OnOpen, id=wx.ID_OPEN) wxglade_tmp_menu.Append(wx.ID_EXIT, _("&Quit"), "") self.Bind(wx.EVT_MENU, self.OnClose, id=wx.ID_EXIT) self.Mp3_To_Ogg_menubar.Append(wxglade_tmp_menu, _("&File")) wxglade_tmp_menu = wx.Menu() wxglade_tmp_menu.Append(wx.ID_ABOUT, _("&About"), _("About dialog")) self.Bind(wx.EVT_MENU, self.OnAboutDialog, id=wx.ID_ABOUT) self.Mp3_To_Ogg_menubar.Append(wxglade_tmp_menu, _("&Help")) self.SetMenuBar(self.Mp3_To_Ogg_menubar) # Menu Bar end self.Mp3_To_Ogg_statusbar = self.CreateStatusBar(2) self.Mp3_To_Ogg_statusbar.SetStatusWidths([-2, -1]) # statusbar fields Mp3_To_Ogg_statusbar_fields = [_("Mp3_To_Ogg_statusbar"), ""] for i in range(len(Mp3_To_Ogg_statusbar_fields)): self.Mp3_To_Ogg_statusbar.SetStatusText( Mp3_To_Ogg_statusbar_fields[i], i) # Tool Bar self.Mp3_To_Ogg_toolbar = wx.ToolBar(self, -1, style=wx.TB_TEXT) self.Mp3_To_Ogg_toolbar.AddTool( wx.ID_OPEN, _("&Open"), wx.NullBitmap, wx.NullBitmap, wx.ITEM_NORMAL, _("Open a file"), _("Open a MP3 file to convert into OGG format")) self.Bind(wx.EVT_TOOL, self.OnOpen, id=wx.ID_OPEN) self.SetToolBar(self.Mp3_To_Ogg_toolbar) self.Mp3_To_Ogg_toolbar.Realize() # Tool Bar end sizer_1 = wx.FlexGridSizer(3, 1, 0, 0) self.notebook_1 = wx.Notebook(self, wx.ID_ANY, style=wx.NB_BOTTOM) sizer_1.Add(self.notebook_1, 1, wx.EXPAND, 0) self.notebook_1_pane_1 = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_pane_1, _("Input File")) _gszr_pane1 = wx.FlexGridSizer(1, 3, 0, 0) _lbl_input_filename = wx.StaticText(self.notebook_1_pane_1, wx.ID_ANY, _("File name:")) _gszr_pane1.Add(_lbl_input_filename, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.text_ctrl_1 = wx.TextCtrl(self.notebook_1_pane_1, wx.ID_ANY, "") self.text_ctrl_1.SetBackgroundColour(wx.NullColour) _gszr_pane1.Add(self.text_ctrl_1, 1, wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.EXPAND, 5) self.button_3 = wx.Button(self.notebook_1_pane_1, wx.ID_OPEN, "") _gszr_pane1.Add(self.button_3, 0, wx.ALL, 5) self.notebook_1_pane_2 = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_pane_2, _("Converting Options")) sizer_4 = wx.BoxSizer(wx.HORIZONTAL) self.rbx_sampling_rate = wx.RadioBox( self.notebook_1_pane_2, wx.ID_ANY, _("Sampling Rate"), choices=[_("44 kbit"), _("128 kbit")], majorDimension=0, style=wx.RA_SPECIFY_ROWS) self.rbx_sampling_rate.SetSelection(0) sizer_4.Add(self.rbx_sampling_rate, 1, wx.ALL | wx.EXPAND, 5) sizer_3 = wx.StaticBoxSizer( wx.StaticBox(self.notebook_1_pane_2, wx.ID_ANY, _("Misc")), wx.HORIZONTAL) sizer_4.Add(sizer_3, 1, wx.ALL | wx.EXPAND, 5) self.cbx_love = wx.CheckBox(self.notebook_1_pane_2, wx.ID_ANY, _(u"♥ Love this song")) self.cbx_love.SetToolTipString(_(u"Yes!\nWe ♥ it!")) self.cbx_love.SetValue(1) sizer_3.Add(self.cbx_love, 0, wx.ALL | wx.SHAPED, 5) self.notebook_1_pane_3 = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_pane_3, _("Converting Progress")) _szr_pane3 = wx.BoxSizer(wx.HORIZONTAL) self.text_ctrl_2 = wx.TextCtrl(self.notebook_1_pane_3, wx.ID_ANY, "", style=wx.TE_MULTILINE) _szr_pane3.Add(self.text_ctrl_2, 1, wx.ALL | wx.EXPAND, 5) self.notebook_1_pane_4 = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_pane_4, _("Output File")) _gszr_pane4 = wx.FlexGridSizer(2, 3, 0, 0) self._lbl_output_filename = wx.StaticText(self.notebook_1_pane_4, wx.ID_ANY, _("File name:")) _gszr_pane4.Add(self._lbl_output_filename, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.text_ctrl_3 = wx.TextCtrl(self.notebook_1_pane_4, wx.ID_ANY, "") self.text_ctrl_3.SetToolTipString( _("File name of the output file\nAn existing file will be overwritten without futher information!" )) _gszr_pane4.Add(self.text_ctrl_3, 0, wx.ALL | wx.EXPAND, 5) self.button_4 = wx.Button(self.notebook_1_pane_4, wx.ID_OPEN, "") _gszr_pane4.Add(self.button_4, 0, wx.ALL, 5) _gszr_pane4.Add((20, 20), 0, 0, 0) self.checkbox_1 = wx.CheckBox(self.notebook_1_pane_4, wx.ID_ANY, _("Overwrite existing file")) self.checkbox_1.SetToolTipString(_("Overwrite an existing file")) self.checkbox_1.SetValue(1) _gszr_pane4.Add(self.checkbox_1, 0, wx.ALL | wx.EXPAND, 5) _gszr_pane4.Add((20, 20), 0, 0, 0) self.notebook_1_pane_5 = wx.Panel(self.notebook_1, wx.ID_ANY) self.notebook_1.AddPage(self.notebook_1_pane_5, _("Some Text")) sizer_5 = wx.BoxSizer(wx.HORIZONTAL) self.label_1 = wx.StaticText( self.notebook_1_pane_5, wx.ID_ANY, _("Please check the format of those lines manually:\n\nSingle line without any special characters.\n\na line break between new and line: new\nline\na tab character between new and line: new\tline\ntwo backslash characters: \\\\ \nthree backslash characters: \\\\\\ \na double quote: \"\nan escaped new line sequence: \\n" )) sizer_5.Add(self.label_1, 1, wx.ALL | wx.EXPAND, 5) self.static_line_1 = wx.StaticLine(self, wx.ID_ANY) sizer_1.Add(self.static_line_1, 0, wx.ALL | wx.EXPAND, 5) sizer_2 = wx.FlexGridSizer(1, 3, 0, 0) sizer_1.Add(sizer_2, 0, wx.ALIGN_RIGHT, 0) self.button_5 = wx.Button(self, wx.ID_CLOSE, "") sizer_2.Add(self.button_5, 0, wx.ALIGN_RIGHT | wx.ALL, 5) self.button_2 = wx.Button(self, wx.ID_CANCEL, "", style=wx.BU_TOP) sizer_2.Add(self.button_2, 0, wx.ALIGN_RIGHT | wx.ALL, 5) self.button_1 = wx.Button(self, wx.ID_OK, "", style=wx.BU_TOP) sizer_2.Add(self.button_1, 0, wx.ALIGN_RIGHT | wx.ALL, 5) self.notebook_1_pane_5.SetSizer(sizer_5) _gszr_pane4.AddGrowableCol(1) self.notebook_1_pane_4.SetSizer(_gszr_pane4) self.notebook_1_pane_3.SetSizer(_szr_pane3) self.notebook_1_pane_2.SetSizer(sizer_4) _gszr_pane1.AddGrowableCol(1) self.notebook_1_pane_1.SetSizer(_gszr_pane1) sizer_1.AddGrowableRow(0) sizer_1.AddGrowableCol(0) self.SetSizer(sizer_1) sizer_1.SetSizeHints(self) self.Layout() self.Centre() self.Bind(wx.EVT_BUTTON, self.startConverting, self.button_1)
def add_items(self, content, panel, sizer): """ Adds a list of Item objects to the panel. """ # Get local references to various objects we need: ui = self.ui info = ui.info handler = ui.handler group = self.group show_left = group.show_left padding = group.padding col = -1 col_incr = 1 self.label_flags = 0 show_labels = False for item in content: show_labels |= item.show_label if (not self.is_horizontal) and (show_labels or (group.columns > 1)): # For a vertical list of Items with labels or multiple columns, use # a 'FlexGridSizer': self.label_pad = 0 cols = group.columns if show_labels: cols *= 2 col_incr = 2 flags = wx.TOP | wx.BOTTOM border_size = 1 item_sizer = wx.FlexGridSizer(0, cols, 0, 5) if show_left: self.label_flags = wx.ALIGN_RIGHT if show_labels: for i in range(1, cols, 2): item_sizer.AddGrowableCol(i) else: # Otherwise, the current sizer will work as is: self.label_pad = 4 cols = 1 flags = wx.ALL border_size = 1 item_sizer = sizer # Process each Item in the list: for item in content: # Get the name in order to determine its type: name = item.name # Check if is a label: if name == '': label = item.label if label != '': # Update the column counter: col += col_incr # If we are building a multi-column layout with labels, # just add space in the next column: if (cols > 1) and show_labels: item_sizer.Add((1, 1)) if item.style == 'simple': # Add a simple text label: label = wx.StaticText(panel, -1, label, style=wx.ALIGN_LEFT) item_sizer.Add(label, 0, wx.EXPAND) else: # Add the label to the sizer: label = heading_text(panel, text=label).control item_sizer.Add(label, 0, wx.TOP | wx.BOTTOM | wx.EXPAND, 3) if item.emphasized: self._add_emphasis(label) # Continue on to the next Item in the list: continue # Update the column counter: col += col_incr # Check if it is a separator: if name == '_': for i in range(cols): if self.is_horizontal: # Add a vertical separator: line = wx.StaticLine(panel, -1, style=wx.LI_VERTICAL) item_sizer.Add(line, 0, wx.LEFT | wx.RIGHT | wx.EXPAND, 2) else: # Add a horizontal separator: line = wx.StaticLine(panel, -1, style=wx.LI_HORIZONTAL) item_sizer.Add(line, 0, wx.TOP | wx.BOTTOM | wx.EXPAND, 2) self._set_owner(line, item) # Continue on to the next Item in the list: continue # Convert a blank to a 5 pixel spacer: if name == ' ': name = '5' # Check if it is a spacer: if all_digits.match(name): # If so, add the appropriate amount of space to the sizer: n = int(name) if self.is_horizontal: item_sizer.Add((n, 1)) else: spacer = (1, n) item_sizer.Add(spacer) if show_labels: item_sizer.Add(spacer) # Continue on to the next Item in the list: continue # Otherwise, it must be a trait Item: object = eval(item.object_, globals(), ui.context) trait = object.base_trait(name) desc = trait.tooltip if desc is None: desc = 'Specifies ' + trait.desc if trait.desc else '' label = None # If we are displaying labels on the left, add the label to the # user interface: if show_left: if item.show_label: label = self.create_label(item, ui, desc, panel, item_sizer, border=group.show_border) elif (cols > 1) and show_labels: label = self.dummy_label(panel, item_sizer) # Get the editor factory associated with the Item: editor_factory = item.editor if editor_factory is None: editor_factory = trait.get_editor() # If still no editor factory found, use a default text editor: if editor_factory is None: from .text_editor import ToolkitEditorFactory editor_factory = ToolkitEditorFactory() # If the item has formatting traits set them in the editor # factory: if item.format_func is not None: editor_factory.format_func = item.format_func if item.format_str != '': editor_factory.format_str = item.format_str # If the item has an invalid state extended trait name, set it # in the editor factory: if item.invalid != '': editor_factory.invalid = item.invalid # Set up the background image (if used): item_panel = panel # Create the requested type of editor from the editor factory: factory_method = getattr(editor_factory, item.style + '_editor') editor = factory_method(ui, object, name, item.tooltip, item_panel).trait_set( item=item, object_name=item.object) # Tell editor to actually build the editing widget: editor.prepare(item_panel) # Set the initial 'enabled' state of the editor from the factory: editor.enabled = editor_factory.enabled # Add emphasis to the editor control if requested: if item.emphasized: self._add_emphasis(editor.control) # Give the editor focus if it requested it: if item.has_focus: editor.control.SetFocus() # Adjust the maximum border size based on the editor's settings: border_size = min(border_size, editor.border_size) # Set up the reference to the correct 'control' to use in the # following section, depending upon whether we have wrapped an # ImagePanel around the editor control or not: control = editor.control width, height = control.GetSizeTuple() # Set the correct size on the control, as specified by the user: scrollable = editor.scrollable item_width = item.width item_height = item.height growable = 0 if (item_width != -1.0) or (item_height != -1.0): if (0.0 < item_width <= 1.0) and self.is_horizontal: growable = int(1000.0 * item_width) item_width = -1 item_width = int(item_width) if item_width < -1: item_width = -item_width elif item_width != -1: item_width = max(item_width, width) if (0.0 < item_height <= 1.0) and (not self.is_horizontal): growable = int(1000.0 * item_height) item_height = -1 item_height = int(item_height) if item_height < -1: item_height = -item_height elif item_height != -1: item_height = max(item_height, height) control.SetMinSize(wx.Size(item_width, item_height)) # Bind the item to the control and all of its children: self._set_owner(control, item) # Bind the editor into the UIInfo object name space so it can be # referred to by a Handler while the user interface is active: id = item.id or name info.bind(id, editor, item.id) # Also, add the editors to the list of editors used to construct # the user interface: ui._editors.append(editor) # If the handler wants to be notified when the editor is created, # add it to the list of methods to be called when the UI is # complete: defined = getattr(handler, id + '_defined', None) if defined is not None: ui.add_defined(defined) # If the editor is conditionally visible, add the visibility # 'expression' and the editor to the UI object's list of monitored # objects: if item.visible_when != '': ui.add_visible(item.visible_when, editor) # If the editor is conditionally enabled, add the enabling # 'expression' and the editor to the UI object's list of monitored # objects: if item.enabled_when != '': ui.add_enabled(item.enabled_when, editor) # Add the created editor control to the sizer with the appropriate # layout flags and values: ui._scrollable |= scrollable item_resizable = ((item.resizable is True) or ((item.resizable is Undefined) and scrollable)) if item_resizable: growable = growable or 500 self.resizable = True elif item.springy: growable = growable or 500 # The following is a hack to allow 'readonly' text fields to # work correctly (wx has a bug that setting wx.EXPAND on a # StaticText control seems to cause the text to be aligned higher # than it would be otherwise, causing it to misalign with its # label). layout_style = editor.layout_style if not show_labels: layout_style |= wx.EXPAND item_sizer.Add(control, growable, flags | layout_style | wx.ALIGN_CENTER_VERTICAL, max(0, border_size + padding + item.padding)) # If we are displaying labels on the right, add the label to the # user interface: if not show_left: if item.show_label: label = self.create_label(item, ui, desc, panel, item_sizer, '', wx.RIGHT) elif (cols > 1) and show_labels: label = self.dummy_label(panel, item_sizer) # If the Item is resizable, and we are using a multi-column grid: if item_resizable and (cols > 1): # Mark the entire row as growable: item_sizer.AddGrowableRow(col / cols) # Save the reference to the label control (if any) in the editor: editor.label_control = label # If we created a grid sizer, add it to the original sizer: if item_sizer is not sizer: growable = 0 if self.resizable: growable = 1 sizer.Add(item_sizer, growable, wx.EXPAND | wx.ALL, 2)
def __init__(self, parent, game_controller): wx.Panel.__init__(self, parent) sizer = wx.BoxSizer(wx.VERTICAL) resolution_strings = get_resolution_strings(RESOLUTIONS) # Settings add_opener_buttons( self, sizer, { 'Edit autoexec.cfg (with default editor)': dirs.data / 'id1' / 'autoexec.cfg', 'Edit config.cfg (with default editor)': dirs.data / 'id1' / 'config.cfg' }) # Install registered data add_widget(sizer, wx.StaticLine(self, -1)) reg_data_button = wx.Button(self, -1, 'Install registered Quake data') reg_data_button.Bind(wx.EVT_BUTTON, self.install_data_handler) add_widget(sizer, reg_data_button) # Video mode settings add_widget(sizer, wx.StaticLine(self, -1)) box = platform_appropriate_grouping(self, 'Video mode') res_label = wx.StaticText(self, label='Resolution:') res_pick = wx.Choice(self, -1, choices=resolution_strings) try: index = int(config.resolution()) except: # noqa 722 index = DEFAULT_RESOLUTION_INDEX res_pick.SetSelection(index) res_pick.Bind(wx.EVT_CHOICE, lambda event: config.resolution(event.GetSelection())) add_widget(box, associate_controls(res_label, res_pick)) doset_only(windows=lambda: add_widget( box, wx.StaticText(self, -1, "Modes may be cropped when Windows' UI is scaled."))) def mode_test(event): doset_only( windows=lambda: first_time_windows_firewall_info(parent)) if not game_flickering_check(parent): return game_controller.launch_tutorial() quick_test = wx.Button(self, -1, 'Try it out: Play tutorial') quick_test.Bind(wx.EVT_BUTTON, mode_test) add_widget(box, quick_test) def reset_to_defaults(event): res_pick.SetSelection(DEFAULT_RESOLUTION_INDEX) choice_event = wx.CommandEvent(wx.wxEVT_CHOICE) choice_event.SetInt(DEFAULT_RESOLUTION_INDEX) wx.PostEvent(res_pick, choice_event) res_pick.Enable() reset = wx.Button(self, -1, 'Reset video mode to default') reset.Bind(wx.EVT_BUTTON, reset_to_defaults) add_widget(box, reset) add_widget(sizer, box) # Wiring sizer.SetSizeHints(self) self.SetSizer(sizer)
def __init__(self, parent): if AddonsDialog._instance() is not None: return # #7077: _instance must not be kept alive once the dialog is closed or there can be issues # when add-ons manager reopens or another add-on is installed remotely. AddonsDialog._instance = weakref.ref(self) # Translators: The title of the Addons Dialog title = _("Add-ons Manager") # Translators: The title of the Addons Dialog when add-ons are disabled titleWhenAddonsAreDisabled = _("Add-ons Manager (add-ons disabled)") wx.Dialog.__init__(self, parent, title=title if not globalVars.appArgs.disableAddons else titleWhenAddonsAreDisabled) DpiScalingHelperMixin.__init__(self, self.GetHandle()) mainSizer = wx.BoxSizer(wx.VERTICAL) firstTextSizer = wx.BoxSizer(wx.VERTICAL) listAndButtonsSizerHelper = guiHelper.BoxSizerHelper( self, sizer=wx.BoxSizer(wx.HORIZONTAL)) if globalVars.appArgs.disableAddons: # Translators: A message in the add-ons manager shown when add-ons are globally disabled. label = _( "NVDA was started with all add-ons disabled. " "You may modify the enabled / disabled state, and install or uninstall add-ons. " "Changes will not take effect until after NVDA is restarted.") addonsDisabledText = wx.StaticText(self, label=label) addonsDisabledText.Wrap(self.scaleSize(670)) firstTextSizer.Add(addonsDisabledText) # Translators: the label for the installed addons list in the addons manager. entriesLabel = _("Installed Add-ons") firstTextSizer.Add(wx.StaticText(self, label=entriesLabel)) mainSizer.Add(firstTextSizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.TOP | wx.LEFT | wx.RIGHT) self.addonsList = listAndButtonsSizerHelper.addItem( nvdaControls.AutoWidthColumnListCtrl( parent=self, style=wx.LC_REPORT | wx.LC_SINGLE_SEL, size=self.scaleSize((550, 350)))) # Translators: The label for a column in add-ons list used to identify add-on package name (example: package is OCR). self.addonsList.InsertColumn(0, _("Package"), width=self.scaleSize(150)) # Translators: The label for a column in add-ons list used to identify add-on's running status (example: status is running). self.addonsList.InsertColumn(1, _("Status"), width=self.scaleSize(50)) # Translators: The label for a column in add-ons list used to identify add-on's version (example: version is 0.3). self.addonsList.InsertColumn(2, _("Version"), width=self.scaleSize(50)) # Translators: The label for a column in add-ons list used to identify add-on's author (example: author is NV Access). self.addonsList.InsertColumn(3, _("Author"), width=self.scaleSize(300)) self.addonsList.Bind(wx.EVT_LIST_ITEM_FOCUSED, self.onListItemSelected) # this is the group of buttons that affects the currently selected addon entryButtonsHelper = guiHelper.ButtonHelper(wx.VERTICAL) # Translators: The label for a button in Add-ons Manager dialog to show information about the selected add-on. self.aboutButton = entryButtonsHelper.addButton( self, label=_("&About add-on...")) self.aboutButton.Disable() self.aboutButton.Bind(wx.EVT_BUTTON, self.onAbout) # Translators: The label for a button in Add-ons Manager dialog to show the help for the selected add-on. self.helpButton = entryButtonsHelper.addButton(self, label=_("Add-on &help")) self.helpButton.Disable() self.helpButton.Bind(wx.EVT_BUTTON, self.onHelp) # Translators: The label for a button in Add-ons Manager dialog to enable or disable the selected add-on. self.enableDisableButton = entryButtonsHelper.addButton( self, label=_("&Disable add-on")) self.enableDisableButton.Disable() self.enableDisableButton.Bind(wx.EVT_BUTTON, self.onEnableDisable) # Translators: The label for a button to remove either: # Remove the selected add-on in Add-ons Manager dialog. # Remove a speech dictionary entry. self.removeButton = entryButtonsHelper.addButton(self, label=_("&Remove")) self.removeButton.Disable() self.removeButton.Bind(wx.EVT_BUTTON, self.onRemoveClick) listAndButtonsSizerHelper.addItem(entryButtonsHelper.sizer) mainSizer.Add(listAndButtonsSizerHelper.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.ALL) # the following buttons are more general and apply regardless of the current selection. generalActions = guiHelper.ButtonHelper(wx.HORIZONTAL) # Translators: The label of a button in Add-ons Manager to open the Add-ons website and get more add-ons. self.getAddonsButton = generalActions.addButton( self, label=_("&Get add-ons...")) self.getAddonsButton.Bind(wx.EVT_BUTTON, self.onGetAddonsClick) # Translators: The label for a button in Add-ons Manager dialog to install an add-on. self.addButton = generalActions.addButton(self, label=_("&Install...")) self.addButton.Bind(wx.EVT_BUTTON, self.onAddClick) # Translators: The label of a button in the Add-ons Manager to open the list of incompatible add-ons. self.incompatAddonsButton = generalActions.addButton( self, label=_("&View incompatible add-ons...")) self.incompatAddonsButton.Bind(wx.EVT_BUTTON, self.onIncompatAddonsShowClick) mainSizer.Add(generalActions.sizer, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.LEFT | wx.RIGHT) mainSizer.Add(wx.StaticLine(self), border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.TOP | wx.BOTTOM | wx.EXPAND) # Translators: The label of a button to close the Addons dialog. closeButton = wx.Button(self, label=_("&Close"), id=wx.ID_CLOSE) closeButton.Bind(wx.EVT_BUTTON, lambda evt: self.Close()) mainSizer.Add(closeButton, border=guiHelper.BORDER_FOR_DIALOGS, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.CENTER | wx.ALIGN_RIGHT) self.Bind(wx.EVT_CLOSE, self.onClose) self.EscapeId = wx.ID_CLOSE mainSizer.Fit(self) self.SetSizer(mainSizer) self.refreshAddonsList() self.addonsList.SetFocus() self.CentreOnScreen()
def __init__(self, parent): wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=u"Envision Reader", pos=wx.DefaultPosition, size=wx.Size(485, 320), style=wx.DEFAULT_DIALOG_STYLE) self.SetSizeHints(wx.DefaultSize, wx.DefaultSize) self.ImportScreen = parent bSizer1 = wx.BoxSizer(wx.VERTICAL) bSizer3 = wx.BoxSizer(wx.HORIZONTAL) bSizer7 = wx.BoxSizer(wx.VERTICAL) self.m_notebook1 = wx.Notebook(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0) self.panBookmark = wx.Panel(self.m_notebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) bSizer8 = wx.BoxSizer(wx.HORIZONTAL) bSizer9 = wx.BoxSizer(wx.VERTICAL) self.searchBookmark = wx.SearchCtrl(self.panBookmark, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) self.searchBookmark.ShowSearchButton(True) self.searchBookmark.ShowCancelButton(True) bSizer9.Add(self.searchBookmark, 0, wx.ALL | wx.EXPAND, 5) lstBoxBookmarkChoices = list(self.ImportScreen.dictBookmarkData.keys()) self.lstBoxBookmark = wx.ListBox(self.panBookmark, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, lstBoxBookmarkChoices, wx.LB_NEEDED_SB) bSizer9.Add(self.lstBoxBookmark, 1, wx.ALL | wx.EXPAND, 5) bSizer8.Add(bSizer9, 1, wx.EXPAND, 5) bSizer10 = wx.BoxSizer(wx.VERTICAL) #bSizer10.AddSpacer( wx.DefaultSize, 0, wx.EXPAND, 5 ) self.btnBMGo = wx.Button(self.panBookmark, wx.ID_ANY, u"Go To Bookmark", wx.DefaultPosition, wx.DefaultSize, 0) bSizer10.Add(self.btnBMGo, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5) self.btnBMPrevious = wx.Button(self.panBookmark, wx.ID_ANY, u"Previous", wx.DefaultPosition, wx.DefaultSize, 0) bSizer10.Add(self.btnBMPrevious, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) self.btnBMNext = wx.Button(self.panBookmark, wx.ID_ANY, u"Next", wx.DefaultPosition, wx.DefaultSize, 0) bSizer10.Add(self.btnBMNext, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) self.btnBMDelete = wx.Button(self.panBookmark, wx.ID_ANY, u"Delete", wx.DefaultPosition, wx.DefaultSize, 0) bSizer10.Add(self.btnBMDelete, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) self.btnBMDeleteAll = wx.Button(self.panBookmark, wx.ID_ANY, u"Delete All", wx.DefaultPosition, wx.DefaultSize, 0) bSizer10.Add(self.btnBMDeleteAll, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) bSizer8.Add(bSizer10, 1, wx.EXPAND | wx.ALIGN_BOTTOM | wx.TOP, 5) self.panBookmark.SetSizer(bSizer8) self.panBookmark.Layout() bSizer8.Fit(self.panBookmark) self.m_notebook1.AddPage(self.panBookmark, u"Bookmark", True) self.pnlHeading = wx.Panel(self.m_notebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) bSizer11 = wx.BoxSizer(wx.HORIZONTAL) bSizer12 = wx.BoxSizer(wx.VERTICAL) self.searchHeading = wx.SearchCtrl(self.pnlHeading, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) self.searchHeading.ShowSearchButton(True) self.searchHeading.ShowCancelButton(True) bSizer12.Add(self.searchHeading, 0, wx.ALL | wx.EXPAND, 5) lstBoxHeadingChoices = [] self.lstBoxHeading = wx.ListBox(self.pnlHeading, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, lstBoxHeadingChoices, wx.LB_NEEDED_SB) bSizer12.Add(self.lstBoxHeading, 1, wx.ALL | wx.EXPAND, 5) bSizer11.Add(bSizer12, 1, wx.EXPAND, 5) bSizer13 = wx.BoxSizer(wx.VERTICAL) #bSizer13.AddSpacer( ( 0, 25), 0, 0, 5 ) self.btnHeadGo = wx.Button(self.pnlHeading, wx.ID_ANY, u"Go To Heading", wx.DefaultPosition, wx.DefaultSize, 0) bSizer13.Add(self.btnHeadGo, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5) self.btnHeadPrevious = wx.Button(self.pnlHeading, wx.ID_ANY, u"Previous", wx.DefaultPosition, wx.DefaultSize, 0) bSizer13.Add(self.btnHeadPrevious, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) self.btnHeadNext = wx.Button(self.pnlHeading, wx.ID_ANY, u"Next", wx.DefaultPosition, wx.DefaultSize, 0) bSizer13.Add(self.btnHeadNext, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5) bSizer11.Add(bSizer13, 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.TOP, 5) self.pnlHeading.SetSizer(bSizer11) self.pnlHeading.Layout() bSizer11.Fit(self.pnlHeading) self.m_notebook1.AddPage(self.pnlHeading, u"Headings", False) bSizer7.Add(self.m_notebook1, 1, wx.EXPAND | wx.ALL, 5) bSizer3.Add(bSizer7, 1, wx.EXPAND, 5) bSizer1.Add(bSizer3, 1, wx.EXPAND, 5) self.m_staticline2 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) bSizer1.Add(self.m_staticline2, 0, wx.EXPAND | wx.ALL, 5) bSizer4 = wx.BoxSizer(wx.HORIZONTAL) self.btnCancel = wx.Button(self, wx.ID_ANY, u"Cancel", wx.DefaultPosition, wx.DefaultSize, 0) bSizer4.Add(self.btnCancel, 0, wx.ALL, 5) self.btnCancel.Bind(wx.EVT_BUTTON, self.OnClose) bSizer1.Add(bSizer4, 0, wx.ALIGN_RIGHT, 5) self.Bind(wx.EVT_CHAR_HOOK, self.OnKeyUP) self.SetSizer(bSizer1) self.Layout() self.Centre(wx.BOTH) # Connect Events self.m_notebook1.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.OnTabChanged) self.btnBMGo.Bind(wx.EVT_BUTTON, self.OnGoToBookmark) self.btnBMPrevious.Bind(wx.EVT_BUTTON, self.OnBMPrevious) self.btnBMNext.Bind(wx.EVT_BUTTON, self.OnBMNext) self.btnBMDelete.Bind(wx.EVT_BUTTON, self.OnBMDelete) self.btnBMDeleteAll.Bind(wx.EVT_BUTTON, self.OnBMDeleteAll) self.btnHeadGo.Bind(wx.EVT_BUTTON, self.OnGoToHeading) self.btnHeadPrevious.Bind(wx.EVT_BUTTON, self.OnHeadingPrevious) self.btnHeadNext.Bind(wx.EVT_BUTTON, self.OnHeadingNext) self.searchBookmark.Bind(wx.EVT_TEXT_ENTER, self.OnBMSearchEnter) self.searchBookmark.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, self.OnBMSearchEnter) self.searchBookmark.Bind(wx.EVT_SEARCHCTRL_CANCEL_BTN, self.OnBMSearchCancel)
def _buildTopBar(self, parent): """ Widget building """ sizer0 = wx.BoxSizer(wx.VERTICAL) #-- sizer1 = wx.BoxSizer(wx.HORIZONTAL) txt1 = wx.StaticText(parent, -1, 'Name Server:') txt1.SetForegroundColour(wx.BLUE) sizer1.Add(txt1, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTRE | wx.ALL, 5) self.txtCtrlNSHost = wx.TextCtrl(parent, -1, '', size=wx.Size(300, -1), style=wx.TE_PROCESS_ENTER) sizer1.Add(self.txtCtrlNSHost, 0, wx.ALIGN_LEFT | wx.ALIGN_BOTTOM | wx.TOP | wx.BOTTOM, 5) txtColon = wx.StaticText(parent, -1, ':') txtColon.SetForegroundColour(wx.BLUE) sizer1.Add(txtColon, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTRE | wx.TOP | wx.BOTTOM, 5) self.txtCtrlNSPort = wx.TextCtrl(parent, -1, '', size=wx.Size(50, -1), style=wx.TE_PROCESS_ENTER) sizer1.Add(self.txtCtrlNSPort, 0, wx.ALIGN_LEFT | wx.ALIGN_BOTTOM | wx.TOP | wx.BOTTOM, 5) self.buttonUpdate = wx.Button(parent, -1, 'Update') # buttonUpdate sizer1.Add(self.buttonUpdate, 0, wx.ALIGN_LEFT | wx.ALL, 5) self.buttonPing = wx.Button(parent, -1, 'Ping') # buttonPing sizer1.Add(self.buttonPing, 0, wx.ALIGN_LEFT | wx.ALL, 5) sizer0.Add(sizer1, 0, wx.ALIGN_LEFT | wx.GROW, 5) #-- lineH1 = wx.StaticLine(parent, -1, style=wx.LI_HORIZONTAL) sizer0.Add(lineH1, 0, wx.GROW | wx.ALIGN_CENTRE | wx.LEFT | wx.RIGHT, 5) #-- sizer2 = wx.BoxSizer(wx.HORIZONTAL) self.buttonDeleteGroup = wx.Button(parent, -1, ' Delete group(s) ') sizer2.Add( self.buttonDeleteGroup, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER | wx.TOP | wx.LEFT | wx.BOTTOM, 5) self.buttonCreateGroup = wx.Button(parent, -1, ' Create group... ') sizer2.Add( self.buttonCreateGroup, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER | wx.TOP | wx.LEFT | wx.BOTTOM, 5) lineV1 = wx.StaticLine(parent, -1, style=wx.LI_VERTICAL) sizer2.Add(lineV1, 0, wx.ALL | wx.GROW, 5) self.buttonDeleteSelected = wx.Button(parent, -1, ' Delete item(s) ') sizer2.Add(self.buttonDeleteSelected, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER | wx.ALL, 5) self.buttonRegisterItem = wx.Button(parent, -1, ' Register item... ') sizer2.Add(self.buttonRegisterItem, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, 5) lineV2 = wx.StaticLine(parent, -1, style=wx.LI_VERTICAL) sizer2.Add(lineV2, 0, wx.ALL | wx.GROW, 5) self.buttonShowMeta = wx.Button(parent, -1, ' Show meta ') sizer2.Add(self.buttonShowMeta, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, 5) self.buttonSetMeta = wx.Button(parent, -1, ' Set meta ') sizer2.Add(self.buttonSetMeta, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, 5) sizer0.Add(sizer2, 0, wx.ALIGN_LEFT, 5) #-- return sizer0
def __init__(self, parent): select = ['random', 'top'] pasts = ['hour', 'day', 'week', 'month', 'year', 'all'] suggested_subreddits = [ 'wallpapers', 'wallpaper', 'EarthPorn', 'BackgroundArt', 'TripleScreenPlus', 'quotepaper', 'BigWallpapers', 'MultiWall', 'DesktopLego', 'VideoGameWallpapers' ] wx.Frame.__init__(self, parent, -1, "Reddit Wallpaper", size=(400, 360)) panel = wx.Panel(self) vbox = wx.BoxSizer(wx.VERTICAL) fgs = wx.FlexGridSizer(6, 2, 9, 25) sub_tc = wx.StaticText(self, label='Subreddits ') self.subredditCombo = wx.ComboBox(self, value=settings['subreddit'], choices=suggested_subreddits) self.subredditCombo.Bind(wx.EVT_TEXT, self.SetSubredditCombo) self.subredditCombo.Bind(wx.EVT_COMBOBOX, self.SetSubredditCombo) sel_tc = wx.StaticText(self, label='Select ') self.selectCombo = wx.ComboBox(self, value=settings['select'], choices=select, style=wx.CB_READONLY) self.selectCombo.Bind(wx.EVT_TEXT, self.SetSelectCombo) self.selectCombo.Bind(wx.EVT_COMBOBOX, self.SetSelectCombo) search_tc = wx.StaticText(self, label='Search ') self.searchText = wx.TextCtrl(self, value=settings['search']) self.searchText.Bind(wx.EVT_TEXT, self.SetSearchText) time_tc = wx.StaticText(self, label='Time ') self.pastCombo = wx.ComboBox(self, choices=pasts, value=settings['past'], style=wx.CB_READONLY) self.pastCombo.Bind(wx.EVT_TEXT, self.SetPastCombo) self.pastCombo.Bind(wx.EVT_COMBOBOX, self.SetPastCombo) dir_tc = wx.StaticText(self, label='Save in ') self.saveDir = wx.TextCtrl(self, value=settings['save_dir']) self.saveDir.Bind(wx.EVT_TEXT, self.SetSaveDir) self.nsfwCheck = wx.CheckBox(self, label='Allowing NSFW wallpapers?') self.nsfwCheck.SetValue(settings['allowNSFW']) self.nsfwCheck.Bind(wx.EVT_CHECKBOX, self.SetNSFWCheck) fgs.AddMany([(sub_tc), (self.subredditCombo, 1, wx.EXPAND), (sel_tc), (self.selectCombo, 1, wx.EXPAND), (search_tc), (self.searchText, 1, wx.EXPAND), (dir_tc), (self.saveDir, 1, wx.EXPAND), (time_tc), (self.pastCombo, 1, wx.EXPAND), (wx.StaticText(self)), (self.nsfwCheck, 1, wx.EXPAND)]) fgs.AddGrowableRow(2, 1) fgs.AddGrowableCol(1, 1) vbox.Add(fgs, proportion=1, flag=wx.ALL | wx.EXPAND, border=15) vbox.Add((-1, 10)) vbox.Add(wx.StaticLine(self), 0, wx.EXPAND) vbox.Add((-1, 10)) setw = wx.Button(self, 0, "Go!") setw.Bind(wx.EVT_BUTTON, self.OnGet) aboutBox = wx.BoxSizer(wx.HORIZONTAL) aboutBox.Add((150, -1)) aboutBox.Add(setw, 0, wx.CENTER | wx.ALL, 10) vbox.Add(aboutBox) self.SetSizer(vbox)
def __init__(self, parent): wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=u"沪深股票日线行情", pos=wx.DefaultPosition, size=wx.Size(281, 183), style=wx.DEFAULT_DIALOG_STYLE) self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) bSizer26 = wx.BoxSizer(wx.VERTICAL) self.m_panel6 = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) bSizer27 = wx.BoxSizer(wx.VERTICAL) fgSizer18 = wx.FlexGridSizer(2, 2, 0, 0) fgSizer18.SetFlexibleDirection(wx.BOTH) fgSizer18.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.m_staticText45 = wx.StaticText(self.m_panel6, wx.ID_ANY, u"沪深股票日线行情", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText45.Wrap(-1) fgSizer18.Add(self.m_staticText45, 0, wx.ALL, 5) fgSizer18.AddSpacer((0, 0), 1, wx.EXPAND, 5) self.m_button12 = wx.Button(self.m_panel6, wx.ID_ANY, u"更新当天数据", wx.DefaultPosition, wx.DefaultSize, 0) fgSizer18.Add(self.m_button12, 0, wx.ALL, 5) self.m_button13 = wx.Button(self.m_panel6, wx.ID_ANY, u"更新前一天数据", wx.DefaultPosition, wx.DefaultSize, 0) fgSizer18.Add(self.m_button13, 0, wx.ALL, 5) bSizer27.Add(fgSizer18, 1, wx.EXPAND, 5) self.m_staticline30 = wx.StaticLine(self.m_panel6, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) bSizer27.Add(self.m_staticline30, 0, wx.EXPAND | wx.ALL, 5) fgSizer20 = wx.FlexGridSizer(2, 2, 0, 0) fgSizer20.SetFlexibleDirection(wx.BOTH) fgSizer20.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.m_staticText47 = wx.StaticText(self.m_panel6, wx.ID_ANY, u"请输入需要更新的日期,格式如20150101", wx.DefaultPosition, wx.DefaultSize, 0) self.m_staticText47.Wrap(-1) fgSizer20.Add(self.m_staticText47, 0, wx.ALL, 5) fgSizer20.AddSpacer((0, 0), 1, wx.EXPAND, 5) fgSizer23 = wx.FlexGridSizer(2, 2, 0, 0) fgSizer23.SetFlexibleDirection(wx.BOTH) fgSizer23.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) self.m_textCtrl74 = wx.TextCtrl(self.m_panel6, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) fgSizer23.Add(self.m_textCtrl74, 0, wx.ALL, 5) self.m_button18 = wx.Button(self.m_panel6, wx.ID_ANY, u"更新该日期数据", wx.DefaultPosition, wx.DefaultSize, 0) fgSizer23.Add(self.m_button18, 0, wx.ALL, 5) fgSizer20.Add(fgSizer23, 1, wx.EXPAND, 5) bSizer27.Add(fgSizer20, 1, wx.EXPAND, 5) self.m_panel6.SetSizer(bSizer27) self.m_panel6.Layout() bSizer27.Fit(self.m_panel6) bSizer26.Add(self.m_panel6, 1, wx.EXPAND | wx.ALL, 5) self.SetSizer(bSizer26) self.Layout() self.Centre(wx.BOTH) # Connect Events self.m_button12.Bind(wx.EVT_BUTTON, self.Onmktequdtoday) self.m_button13.Bind(wx.EVT_BUTTON, self.Onmktequdpreday) self.m_textCtrl74.Bind(wx.EVT_TEXT_ENTER, self.Inputdate) self.m_button18.Bind(wx.EVT_BUTTON, self.Onmktequdoneday) self.inputdate = ''
def createControls(self): localLst = [] modelColumn = wx.BoxSizer(wx.VERTICAL) checkboxColumn = wx.BoxSizer(wx.VERTICAL) statusColumn = wx.BoxSizer(wx.VERTICAL) columnHeaderFont = wx.Font(14, wx.MODERN, wx.ITALIC, wx.LIGHT) modelColumnHeader = wx.StaticText(self.parentPanel, label='Device', style=wx.CENTER) modelColumnHeader.SetFont(columnHeaderFont) modelColumn.Add(modelColumnHeader, 0, wx.CENTER | wx.ALL, 3) checkboxColumnHeader = wx.StaticText(self.parentPanel, label='Check', style=wx.CENTER) checkboxColumnHeader.SetFont(columnHeaderFont) checkboxColumn.Add(checkboxColumnHeader, 0, wx.CENTER | wx.ALL, 3) statusColumnHeader = wx.StaticText(self.parentPanel, label='Status', style=wx.CENTER) statusColumnHeader.SetFont(columnHeaderFont) statusColumn.Add(statusColumnHeader, 0, wx.CENTER | wx.ALL, 3) for deviceId in self.devicesList: _, model = self.adb.getProperty(deviceId, 'ro.product.model') deviceLabel = wx.StaticText(self.parentPanel, label=model, style=wx.CENTER) modelColumn.Add( wx.StaticLine(self.parentPanel, size=(2, 2), style=wx.LI_HORIZONTAL), 0, wx.EXPAND) modelColumn.Add(deviceLabel, 0, wx.CENTER | wx.ALL, 10) checkbox = wx.CheckBox(self.parentPanel, style=wx.CENTER) checkboxColumn.Add( wx.StaticLine(self.parentPanel, size=(2, 2), style=wx.LI_HORIZONTAL), 0, wx.EXPAND) checkboxColumn.Add(checkbox, 0, wx.CENTER | wx.ALL, 10) statusLabel = wx.StaticText(self.parentPanel, label='Ready') statusColumn.Add( wx.StaticLine(self.parentPanel, size=(2, 2), style=wx.LI_HORIZONTAL), 0, wx.EXPAND) statusColumn.Add(statusLabel, 0, wx.CENTER | wx.EXPAND | wx.ALL, 10) localLst.append((deviceId, model, checkbox, statusLabel)) self.Add(modelColumn, 3, wx.EXPAND | wx.CENTER | wx.ALL, 5) self.Add( wx.StaticLine(self.parentPanel, size=(2, 2), style=wx.LI_VERTICAL), 0, wx.EXPAND | wx.ALL, 5) self.Add(checkboxColumn, 1, wx.EXPAND | wx.CENTER | wx.ALL, 5) self.Add( wx.StaticLine(self.parentPanel, size=(2, 2), style=wx.LI_VERTICAL), 0, wx.EXPAND | wx.ALL, 5) self.Add(statusColumn, 3, wx.EXPAND | wx.CENTER | wx.ALL, 5) return localLst
def __init__(self, parent): config = Config() wx.Dialog.__init__(self, parent, -1, "Options", style=wx.DEFAULT_DIALOG_STYLE) sizer = wx.BoxSizer(wx.VERTICAL) label = wx.StaticText(self, -1, "Configure how the Uploader operates") sizer.Add(label, 0, wx.ALIGN_CENTRE | wx.ALL, 5) self.backup = wx.CheckBox(self, -1, "Create CSV dumps the uploaded data") self.backup.SetValue(config['backup']) sizer.Add(self.backup, 0, wx.ALL, 5) self.suggest = wx.CheckBox( self, -1, "Offer suggestions of what can be uploaded") sizer.Add(self.suggest, 0, wx.ALL, 5) self.anon_cb = wx.CheckBox(self, -1, "Anonymous login - no username") self.Bind(wx.EVT_CHECKBOX, self.OnAnonCb, self.anon_cb) sizer.Add(self.anon_cb, 0, wx.ALL, 5) line = wx.StaticLine(self, -1, size=(20, -1), style=wx.LI_HORIZONTAL) sizer.Add(line, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP, 5) box = wx.BoxSizer(wx.HORIZONTAL) label = wx.StaticText(self, -1, "Username:"******"", size=(80, -1)) box.Add(self.uname, 1, wx.ALIGN_CENTRE | wx.ALL, 5) sizer.Add(box, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) box = wx.BoxSizer(wx.HORIZONTAL) label = wx.StaticText(self, -1, "Password: "******"", size=(80, -1), style=wx.TE_PASSWORD) box.Add(self.passwd, 1, wx.ALIGN_CENTRE | wx.ALL, 5) sizer.Add(box, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) line = wx.StaticLine(self, -1, size=(20, -1), style=wx.LI_HORIZONTAL) sizer.Add(line, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP, 5) btnsizer = wx.StdDialogButtonSizer() btn = wx.Button(self, wx.ID_OK) btn.SetDefault() btnsizer.AddButton(btn) btn = wx.Button(self, wx.ID_CANCEL) btnsizer.AddButton(btn) btnsizer.Realize() sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) self.SetSizer(sizer) sizer.Fit(self) char_name = config['character_name'] if char_name == "Anonymous": self.anon_cb.SetValue(True) self.uname.Enable(False) self.passwd.Enable(False) else: self.uname.SetValue(char_name)