def __init_ids(self): """initial some ids""" self.__ids['id_memu_close_db'] = wx.NewId() #get a new id wx.RegisterId(self.__ids['id_memu_close_db']) #make sure this id be global unique self.__ids['id_create_table'] = wx.NewId() #"creat a table" wx.RegisterId(self.__ids['id_create_table']) self.__ids['id_del_row'] = wx.NewId() wx.RegisterId(self.__ids['id_del_row']) self.__ids['id_add_row'] = wx.NewId() wx.RegisterId(self.__ids['id_add_row']) self.__ids['id_update_row'] = wx.NewId() wx.RegisterId(self.__ids['id_update_row'])
def __init__(self, *args, **kwds): for i in range(ID_MINNUM, ID_MAXNUM): wx.RegisterId(i) # begin wxGlade: MyFrame.__init__ kwds["style"] = wx.SYSTEM_MENU | wx.CLOSE_BOX wx.Dialog.__init__(self, *args, **kwds) self.lblList = wx.StaticText( self, -1, "This library is bound to the following paths:") self.lstPaths = wx.ListBox(self, -1, choices=[], style=wx.LB_SINGLE) self.cmdAdd = wx.Button(self, ID_ADD, "Add") self.cmdDelete = wx.Button(self, ID_DELETE, "Delete") self.cmdOK = wx.Button(self, ID_OK, "&OK") self.__set_properties() self.__do_layout() # end wxGlade wx.EVT_BUTTON(self, ID_OK, self.OnOK) wx.EVT_BUTTON(self, ID_ADD, self.OnAdd) wx.EVT_BUTTON(self, ID_DELETE, self.OnDelete) self.paths = []
def initializeTimer(self): id1 = wx.NewId() wx.RegisterId(id1) self.stoper = wx.Timer(self, id1) self.Bind(wx.EVT_TIMER, self.timerUpdate, self.stoper, id1) self.id3 = wx.NewId() wx.RegisterId(self.id3) self.stoper3 = wx.Timer(self, self.id3) self.id4 = wx.NewId() wx.RegisterId(self.id4) self.stoper4 = wx.Timer(self, self.id4) self.Bind(wx.EVT_TIMER, self.pomocniczyStoper, self.stoper4, self.id4) self.stoper.Start(self.timeGap)
def initializeTimer(self): id1 = wx.NewId() wx.RegisterId(id1) self.stoper = wx.Timer(self, id1) self.Bind(wx.EVT_TIMER, self.timerUpdate, self.stoper, id1) if self.control != 'tracker': self.stoper.Start(self.timeGap)
def test_utilsSomeOtherStuff(self): wx.GetBatteryState() wx.GetPowerType() wx.GetKeyState(wx.WXK_F1) wx.GetMousePosition() wx.GetMouseState() wx.EnableTopLevelWindows(True) wx.FindWindowAtPoint((1, 1)) wx.NewId() wx.RegisterId(12345) wx.GetUserName() wx.GetUserId() wx.GetOsDescription()
def initializeTimer(self): id1 = wx.NewId() wx.RegisterId(id1) self.stoper = wx.Timer(self, id1) self.Bind(wx.EVT_TIMER, self.timerUpdate, self.stoper, id1) self.id2 = wx.NewId() wx.RegisterId(self.id2) self.stoper2 = wx.Timer(self, self.id2) self.id3 = wx.NewId() wx.RegisterId(self.id3) self.stoper3 = wx.Timer(self, self.id3) self.id4 = wx.NewId() wx.RegisterId(self.id4) self.stoper4 = wx.Timer(self, self.id4) self.Bind(wx.EVT_TIMER, self.pomocniczyStoper, self.stoper4, self.id4) # if self.control != 'tracker': self.stoper.Start(self.timeGap * 0.15)
def __init__(self, *args, **kwds): kwds['style'] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) # tell wx about our hard coded IDs so that wx.NewId() doesn't collide for i in range(ID_MINNUM, ID_MAXNUM): wx.RegisterId(i) self.lblFilename = wx.StaticText(self, -1, 'FLAC file name here') self.txtTags = wx.TextCtrl(self, -1, '', style=wx.TE_MULTILINE) self.cmdSave = wx.Button(self, ID_SAVE, 'Save') self.cmdCancel = wx.Button(self, ID_CANCEL, 'Cancel') self.__set_properties() self.__do_layout() wx.EVT_BUTTON(self, ID_SAVE, self.OnSave) wx.EVT_BUTTON(self, ID_CANCEL, self.OnCancel)
try: import wx # This module uses the new wx namespace import wx.html except: import pdb import traceback traceback.print_exc() pdb.post_mortem(sys.exc_info()[2]) from wx.lib import buttons # for generic button classes from doodle import DoodleWindow import os, cPickle #---------------------------------------------------------------------- wx.RegisterId(5000) # Give a high starting value for the IDs, just for kicks idNEW = wx.NewId() idOPEN = wx.NewId() idSAVE = wx.NewId() idSAVEAS = wx.NewId() idCLEAR = wx.NewId() idEXIT = wx.NewId() idABOUT = wx.NewId() class DoodleFrame(wx.Frame): """ A DoodleFrame contains a DoodleWindow and a ControlPanel and manages their layout with a wx.BoxSizer. A menu and associated event handlers provides for saving a doodle to a file, etc.
try: # See if there is a multi-version install of wxPython if not hasattr(sys, 'frozen'): import wxversion if wxVersionSelect is None: wxversion.ensureMinimal('2.5') else: wxversion.select(wxVersionSelect) except ImportError: # Otherwise assume a normal 2.4 install, if it isn't 2.4 it will # be caught below pass import wx wx.RegisterId(15999) #warnings.filterwarnings('ignore', '', DeprecationWarning, 'wxPython.imageutils') # Use package version string as it is the only one containing bugfix version number # Remove non number/dot characters wxVersion = wx.__version__ for c in wxVersion: if c not in string.digits+'.': wxVersion = wxVersion.replace(c, '') wxVersion = tuple(map(lambda v: int(v), (wxVersion.split('.')+['0'])[:4])) if wxVersion < __version__.wx_version: wx.PySimpleApp()
_RPC = True if "websocket" in _PARAM: # from autobahn.twisted.websocket import WebSocketClientFactory, WebSocketClientProtocol, connectWS from pytigon_lib.schhttptools.websocket import create_websocket_client _WEBSOCKET = _PARAM["websocket"] if not "channels" in _PARAM: os.environ["PYTIGON_WITHOUT_CHANNELS"] = "1" # import gc # gc.set_debug(gc.DEBUG_STATS | gc.DEBUG_LEAK) # gc.disable() wx.RegisterId(10000) wx.outputWindowClass = None if _INSPECTION: import wx.lib.mixins.inspection App = wx.lib.mixins.inspection.InspectableApp if _TRACE: def trace_calls(frame, event, arg): if event != "call": return co = frame.f_code func_name = co.co_name if func_name == "write":
def __init__(self, *args, **kwds): # begin wxGlade: MainLibFrame.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) # tell wx about our hard coded IDs so wx.NewId() doesn't collide # with them for i in range(ID_MINNUM, ID_MAXNUM): wx.RegisterId(i) # set up list control self.list = wx.ListView(self, -1, style=wx.LC_REPORT | wx.SUNKEN_BORDER) self.list.InsertColumn(0, "Artist", width=150) self.list.InsertColumn(1, "Album", width=350) self.list.InsertColumn(2, "Date", width=100) wx.EVT_LIST_COL_CLICK(self, -1, self.OnListSort) wx.EVT_LIST_ITEM_RIGHT_CLICK(self, -1, self.OnListClick) wx.EVT_LIST_ITEM_ACTIVATED(self, -1, self.OnListDoubleClick) wx.EVT_LIST_ITEM_FOCUSED(self, -1, self.OnListSelect) # set up controls in properties panel self.bmpCoverArt = wx.StaticBitmap(self, -1) self.lblArtist = wx.StaticText(self, -1, "Welcome to Flacenstein") self.lblAlbum = wx.StaticText(self, -1, "Right click to select library items") self.ggeProgress = wx.Gauge(self, -1, 1) # Menu Bar self.library_menubar = wx.MenuBar() self.SetMenuBar(self.library_menubar) wxglade_tmp_menu = wx.Menu() wxglade_tmp_menu.Append(ID_OPEN, "Load Library\tCTRL-O", "", wx.ITEM_NORMAL) wxglade_tmp_menu.Append(ID_SAVE, "Save Library\tCTRL-S", "", wx.ITEM_NORMAL) wxglade_tmp_menu.Append(ID_EXPORT, "Export List", "", wx.ITEM_NORMAL) wxglade_tmp_menu.AppendSeparator() wxglade_tmp_menu.Append(ID_SETPATH, "Configure Paths", "", wx.ITEM_NORMAL) wxglade_tmp_menu.Append(ID_RESCAN, "Rescan\tF5", "", wx.ITEM_NORMAL) wxglade_tmp_menu.AppendSeparator() wxglade_tmp_menu.Append(ID_RIP, "Rip...", "", wx.ITEM_NORMAL) wxglade_tmp_menu.AppendSeparator() wxglade_tmp_menu.Append(wx.ID_EXIT, "Quit\tCTRL-Q", "", wx.ITEM_NORMAL) self.library_menubar.Append(wxglade_tmp_menu, "Library") wxglade_tmp_menu = wx.Menu() wxglade_tmp_menu.Append(ID_LOADSELECT, "Load Selection\tCTRL-G", "", wx.ITEM_NORMAL) wxglade_tmp_menu.Append(ID_SAVESELECT, "Save Selection\tCTRL-D", "", wx.ITEM_NORMAL) wxglade_tmp_menu.AppendSeparator() wxglade_tmp_menu.Append(ID_SELECTALL, "All\tCTRL-A", "", wx.ITEM_NORMAL) wxglade_tmp_menu.Append(ID_SELECTNONE, "None", "", wx.ITEM_NORMAL) self.library_menubar.Append(wxglade_tmp_menu, "Select") tmp_menu = wx.Menu() tmp_menu.Append(ID_CONFIGURE, "Configure", "", wx.ITEM_NORMAL) # mnuStop has to be explicitly created so that we can call .Enable() self.mnuStop = wx.MenuItem(tmp_menu, ID_STOP, "Stop", "", wx.ITEM_NORMAL) tmp_menu.AppendItem(self.mnuStop) tmp_menu.AppendSeparator() self.transforms = {} for xfm in flaccfg.XFM_MODS: global xfmmod xfmmod = __import__('flacenstein.xfm%s' % xfm, globals(), locals(), 'xfm%s' % xfm) i = wx.NewId() self.transforms[i] = xfm tmp_menu.Append(i, xfmmod.description, "", wx.ITEM_NORMAL) works = xfmmod.ready() tmp_menu.Enable(i, works) if not works: print '"%s" module failed self-tests and is disabled.' % \ xfmmod.description wx.EVT_MENU(self, i, self.OnTransform) del xfmmod self.library_menubar.Append(tmp_menu, "Transform") wx.EVT_MENU(self, ID_OPEN, self.OnOpen) wx.EVT_MENU(self, ID_SAVE, self.OnSave) wx.EVT_MENU(self, ID_EXPORT, self.OnExport) wx.EVT_MENU(self, ID_SETPATH, self.OnSetPath) wx.EVT_MENU(self, ID_RESCAN, self.OnRescan) wx.EVT_MENU(self, wx.ID_EXIT, self.OnQuit) wx.EVT_MENU(self, ID_SELECTALL, self.OnSelectAll) wx.EVT_MENU(self, ID_SELECTNONE, self.OnSelectNone) wx.EVT_MENU(self, ID_LOADSELECT, self.OnLoadSelection) wx.EVT_MENU(self, ID_SAVESELECT, self.OnSaveSelection) wx.EVT_MENU(self, ID_CONFIGURE, self.OnConfigure) wx.EVT_MENU(self, ID_STOP, self.OnStop) wx.EVT_MENU(self, ID_RIP, self.OnRip) # Menu Bar end self.library_statusbar = self.CreateStatusBar(1, 0) self.__set_properties() self.__do_layout() # end wxGlade # horrible kludge to try to work around the fact that on my home # machine, e.RequestMore(True) in an idle handler appears to do # nothing: idle events stop coming in if you don't move the mouse, # etc. self.timer = wx.Timer(self, ID_TIMER) wx.EVT_TIMER(self, ID_TIMER, self.OnIdle) #wx.EVT_IDLE(self, self.OnIdle) self.listdict = {} self.sortfields = ["artist", "date"] self.savefile = "flaclibrary.dat" self.listfile = "flacselection.lst" self.outpath = "/tmp/flac" self.parallelism = flaccfg.DEFAULT_PARALLELISM self.children = {} self.jobs = [] self.workinprogress = False self.mnuStop.Enable(False) self.lib = flaclib.FlacLibrary("/mnt/flac") self.lib.statusnotify = self.statusNotify if os.path.isfile(flaccfg.DEFAULT_LIBRARY): self.loadLibrary(flaccfg.DEFAULT_LIBRARY) else: self.lib.scan() self.displayLibrary() self.setState(STATE_IDLE)
IMG_BTN_OFF = "btn_off.png" # Font Size DEFAULT_FONT_SIZE = 8 MAC_FONT_SIZE = 10 # Window Position fron Top DEFAULT_YPOS = 5 YPOS_MAC = 25 # Base directory (populated by main module) BASE_DIR = None # Maximum manually generated ID ID_MAX = 9999 wx.RegisterId(ID_MAX) # ComWindow Widgets ID_BTN_DEV_SCAN = 1000 ID_BTN_CONNECT = 1001 # LoopWindow Widgets ID_TC_PERIOD = 1002 ID_TC_DUTY = 1003 ID_TC_CYCLE = 1004 ID_BTN_START = 1005 ID_MENU_SHOW_APP = 1006 # Menu ID_MENU_FILE_NEW = 1011
def __init__(self, *args, **kwds): # from *args if len(args) == 0: dlg = wx.MessageDialog(self, 'Parameters setting error', 'Error', wx.OK) dlg.ShowModal() dlg.Destroy() return False #self.classid = args[0][0] #self.kidList = args[0][1] #self.adultList = args[0][2] self.recordFileName = args[0][0] #args[0][3] # local variables self.siteList = self.GetSiteList() self.kidList = self.GetKidList() self.adultList = self.GetAdultList() self.observerList = self.GetObserverList() self.classList = self.GetClassList() self.activityList = self.GetActivityList() self.rndKidList = self.kidList[:] self.rndKidList.insert(0, 'Random Select Child') self.vaKidList = self.kidList + self.adultList self.vaKidList.insert(0, '') self.vaKidList.insert(1, '?') self.record = None self.currentGauge = 1 self.observerDict = self.GetRoundInfo() self.currentObserver = '' # GUI kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, None, -1, **kwds) self.CreateStatusBar() panel = wx.Panel(self, -1) self.SetBackgroundColour((217, 241, 255)) self.label_30 = wx.StaticText(panel, -1, '') self.label_31 = wx.StaticText(panel, -1, "Current observation #:") self.input1 = wx.TextCtrl(panel, -1, '', (95, 105)) self.label_20 = wx.StaticText(panel, -1, "Date:") self.label_21 = wx.StaticText(panel, -1, "") self.label_22 = wx.StaticText(panel, -1, "Observer:") self.combo_box_ObserverList = wx.ComboBox(panel, -1, choices=self.observerList, style=wx.CB_DROPDOWN) self.label_23 = wx.StaticText(panel, -1, "Class:") self.combo_box_ClassList = wx.ComboBox(panel, -1, choices=self.classList, style=wx.CB_DROPDOWN) self.label_24 = wx.StaticText(panel, -1, "Round# (today):") #roundList = [str(i) for i in range(1,21)] #roundList.insert(0,'') #self.combo_box_RoundList= wx.ComboBox(panel, -1, choices=roundList, style=wx.CB_DROPDOWN) self.label_26 = wx.StaticText(panel, -1, "# Children present:") #self.label_27 = wx.StaticText(panel, -1, "") numOfChild = [str(i) for i in range(1, len(self.kidList))] numOfChild.insert(0, '') self.combo_box_ChildrenPresent = wx.ComboBox(panel, -1, choices=numOfChild, style=wx.CB_DROPDOWN) self.label_28 = wx.StaticText(panel, -1, "Site:") self.combo_box_SiteList = wx.ComboBox(panel, -1, choices=self.siteList, style=wx.CB_DROPDOWN) self.label_29 = wx.StaticText(panel, -1, "Activity setting:") self.combo_box_ActivityList = wx.ComboBox(panel, -1, choices=self.activityList, style=wx.CB_DROPDOWN) self.button_randSelKid = buttons.GenBitmapButton( panel, -1, bitRedDice.getsmall_red_diceBitmap(), style=1) self.combo_box_RndChildList = wx.ComboBox(panel, -1, choices=self.rndKidList, style=wx.CB_DROPDOWN) self.button_StartRecord = wx.Button(panel, -1, "Start Recording") self.button_SaveRecord = wx.Button(panel, -1, "Save Record") self.button_DiscardRecord = wx.Button(panel, -1, "Discard Record") self.gauge_Timer = wx.Gauge(panel, -1, size=(100, 30)) self.gauge_Timer1 = wx.Gauge(panel, -1, size=(100, 30)) self.label_6 = wx.StaticText(panel, -1, "Attention:") self.radio_box_Attend = wx.RadioBox(panel, -1, "", choices=["N/A", "Glance", "Look"], majorDimension=0, style=wx.RA_SPECIFY_ROWS) self.label_1 = wx.StaticText(panel, -1, "Joint Attention To:") self.label_2 = wx.StaticText(panel, -1, "Attend Target 1:") self.combo_box_TargetChildList1 = wx.ComboBox(panel, -1, choices=self.vaKidList, style=wx.CB_DROPDOWN) self.label_3 = wx.StaticText(panel, -1, "Attend Target 2:") self.combo_box_TargetChildList2 = wx.ComboBox(panel, -1, choices=self.vaKidList, style=wx.CB_DROPDOWN) self.label_4 = wx.StaticText(panel, -1, "Attend Target 3:") self.combo_box_TargetChildList3 = wx.ComboBox(panel, -1, choices=self.vaKidList, style=wx.CB_DROPDOWN) self.label_5 = wx.StaticText(panel, -1, "Attend Target 4:") self.combo_box_TargetChildList4 = wx.ComboBox(panel, -1, choices=self.vaKidList, style=wx.CB_DROPDOWN) self.label_7 = wx.StaticText(panel, -1, "Affect:") self.radio_box_Affect = wx.RadioBox( panel, -1, "", choices=["N/A", "Positive", "Neutral", "Negtive"], majorDimension=0, style=wx.RA_SPECIFY_ROWS) self.label_8 = wx.StaticText(panel, -1, "6 seconds timer:") self.label_9 = wx.StaticText( panel, -1, """ Coder Note: Observe the target child for a period 6-sec.\ Identify each person with whom the target child follows attending behavior.\ Episodes of joint attention are coded as "G" if the child looks briefly (<3-sec) \ at the reference object and coded as "L"\ if the child looks for a longer (>=3-sec). \ After scoring "G" or "L", record affect. """) self.led = gizmos.LEDNumberCtrl(panel, -1) self.__set_properties() #self.__do_layout() self.Bind(wx.EVT_BUTTON, self.RandomSelectChild, self.button_randSelKid) self.Bind(wx.EVT_COMBOBOX, self.RandomChildSelected, self.combo_box_RndChildList) self.Bind(wx.EVT_BUTTON, self.StartRecord, self.button_StartRecord) self.Bind(wx.EVT_BUTTON, self.SaveRecord, self.button_SaveRecord) self.Bind(wx.EVT_BUTTON, self.DiscardRecord, self.button_DiscardRecord) self.Bind(wx.EVT_COMBOBOX, self.SelectVisualTarget1, self.combo_box_TargetChildList1) self.Bind(wx.EVT_COMBOBOX, self.SelectVisualTarget2, self.combo_box_TargetChildList2) self.Bind(wx.EVT_COMBOBOX, self.SelectVisualTarget3, self.combo_box_TargetChildList3) self.Bind(wx.EVT_COMBOBOX, self.SelectVisualTarget4, self.combo_box_TargetChildList4) self.Bind(wx.EVT_RADIOBOX, self.SelectAttend, self.radio_box_Attend) self.Bind(wx.EVT_RADIOBOX, self.SelectAffect, self.radio_box_Affect) self.Bind(wx.EVT_COMBOBOX, self.ObserverSelected, self.combo_box_ObserverList) id1 = wx.NewId() wx.RegisterId(id1) self.timer = wx.Timer(self, id1) self.Bind(wx.EVT_TIMER, self.OnTimer, self.timer, id1) id2 = wx.NewId() wx.RegisterId(id1) self.statusTimer = wx.Timer(self, id2) self.Bind(wx.EVT_TIMER, self.OnStatusTimer, self.statusTimer, id2) self.count = 0 self.statusTimer.Start(1000) self.OnStatusTimer(None)