def __init__(self, size=(300, 300), pos=(100, 100)):
wx.Frame.__init__(self, None, title="Am I transparent?",
style=wx.SIMPLE_BORDER | wx.STAY_ON_TOP | wx.FRAME_NO_TASKBAR)
self.SetClientSize(size)
self.SetPosition(pos)
self.alphaValue = 220
self.alphaIncrement = -4
pnl = wx.Panel(self)
# self.changeAlpha_timer = wx.Timer(self)
# self.changeAlpha_timer.Start(50)
# self.Bind(wx.EVT_TIMER, self.ChangeAlpha)
self.MakeTransparent(self.alphaValue)
self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
python类EVT_TIMER的实例源码
def __init__(self, parent, tagname, window, controler, debug=False, instancepath=""):
if tagname != "" and controler is not None:
self.VARIABLE_PANEL_TYPE = controler.GetPouType(tagname.split("::")[1])
EditorPanel.__init__(self, parent, tagname, window, controler, debug)
self.Keywords = []
self.Variables = {}
self.Functions = {}
self.TypeNames = []
self.Jumps = []
self.EnumeratedValues = []
self.DisableEvents = True
self.TextSyntax = None
self.CurrentAction = None
self.InstancePath = instancepath
self.ContextStack = []
self.CallStack = []
self.ResetSearchResults()
self.RefreshHighlightsTimer = wx.Timer(self, -1)
self.Bind(wx.EVT_TIMER, self.OnRefreshHighlightsTimer, self.RefreshHighlightsTimer)
def __init__(self):
wx.Frame.__init__(self, None, title="Timer Tutorial 2")
panel = wx.Panel(self, wx.ID_ANY)
self.timer = wx.Timer(self, id=TIMER_ID1)
self.Bind(wx.EVT_TIMER, self.update, self.timer)
self.timer2 = wx.Timer(self, id=TIMER_ID2)
self.Bind(wx.EVT_TIMER, self.update, self.timer2)
self.toggleBtn = wx.Button(panel, wx.ID_ANY, "Start Timer 1")
self.toggleBtn.Bind(wx.EVT_BUTTON, self.onStartTimerOne)
self.toggleBtn2 = wx.Button(panel, wx.ID_ANY, "Start Timer 2")
self.toggleBtn2.Bind(wx.EVT_BUTTON, self.onStartTimerOne)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(self.toggleBtn, 0, wx.ALL|wx.CENTER, 5)
sizer.Add(self.toggleBtn2, 0, wx.ALL|wx.CENTER, 5)
panel.SetSizer(sizer)
def __init__(self):
"""Constructor"""
wx.wizard.Wizard.__init__(self, None,
title="Disable Next")
self.SetPageSize((500, 350))
mypage1 = self.create_page1()
forward_btn = self.FindWindowById(wx.ID_FORWARD)
forward_btn.Disable()
self.timer = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.onUpdate, self.timer)
self.timer.Start(1)
self.RunWizard(mypage1)
def __init__(self):
"""Constructor"""
Wizard.__init__(self, None,
title="Disable Next")
self.SetPageSize((500, 350))
mypage1 = self.create_page1()
forward_btn = self.FindWindowById(wx.ID_FORWARD)
forward_btn.Disable()
self.timer = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.onUpdate, self.timer)
self.timer.Start(1)
self.RunWizard(mypage1)
def __init__(self):
wx.Frame.__init__(self, None, title=self.title, size=(660,330))
# Init controller
self.controller = XboxController()
# Create GUI
self.create_main_panel()
# Timer
self.timer = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.on_timer, self.timer)
self.rate = SAMPLE_RATE
self.idle_rate = IDLE_SAMPLE_RATE
self.timer.Start(self.idle_rate)
self.recording = False
self.t = 0
def __init__(self, timelen, services):
wx.Frame.__init__(self, parent=None, title=C_APP_NAME)
self.timelen = timelen * 1000
self.services = services
self.Show(False)
self.Bind(wx.EVT_TIMER, self.OnTimerEvent)
self.Bind(wx.EVT_CLOSE, self.OnExitEvent)
self.timer = wx.Timer(self)
self.timer.Start(self.timelen)
def SetIconTimer(self):
self.icon_timer = wx.Timer(self, ID_ICON_TIMER)
wx.EVT_TIMER(self, ID_ICON_TIMER, self.BlinkIcon)
self.icon_timer.Start(100)
##
# \brief blinks the icon and updates self.l and self.r
#
def convert(self):
self.Bind(wx.EVT_TIMER, self.OnTimer2, self.timer2)
self.dltext.SetLabel(self.query)
self.panel.Layout()
imageFile = 'Files\image.jpg'
data = open(imageFile, "rb").read()
# convert to a data stream
stream = cStringIO.StringIO(data)
# convert to a bitmap
bmp = wx.BitmapFromImage( wx.ImageFromStream( stream ))
# show the bitmap, (5, 5) are upper left corner coordinates
thumb = wx.StaticBitmap(self, -1, bmp, (90,255))
self.Hide()
self.Show()
self.text.SetLabel('Converting...')
if self.rb1.GetValue() == True:
self.timer2.Start(1000)
worker1 = threading.Thread(target=lambda: self.getfile.get_file('http://www.youtube.com/%s'%self.vidurl, '320'))
worker1.start()
elif self.rb2.GetValue() == True:
self.timer2.Start(600)
worker1 = threading.Thread(target=lambda: self.getfile.get_file('http://www.youtube.com/%s'%self.vidurl, '128'))
worker1.start()
def download(self):
self.Bind(wx.EVT_TIMER, self.OnTimer3, self.timer3)
self.timer3.Start(1600)
self.text.SetLabel('Downloading...')
self.filename = self.nametc.GetValue()
file_name = self.new_path + self.filename
try:
worker2 = threading.Thread(target=lambda: self.getfile.download_file(self.getfile.convhtml, file_name ))
worker2.start()
except:
self.Error("Error on conversion! Please retry")
self.reset()
def reset(self):
self.Bind(wx.EVT_TIMER, self.OnTimer1, self.timer1)
self.text.SetLabel('Done!')
self.count = 0
self.count2 = 0
self.count3 = 0
self.nametc.Clear()
self.tc.Clear()
self.timer1 = wx.Timer(self, 1)
self.timer2 = wx.Timer(self, 1)
self.timer3 = wx.Timer(self, 1)
def __init__(self, parent=None, id=-1, title=None):
wx.Frame.__init__(self, parent, id, title)
self.MainPanel = wx.Panel(self, size=(640, 480))
self.MainPanel.SetBackgroundColour('WHITE')
self.panel = wx.Panel(self.MainPanel, size = (640,480))
self.panel.SetBackgroundColour('WHITE')
mainSizer = wx.BoxSizer(wx.VERTICAL)
mainSizer.Add(self.panel)
self.SetSizer(mainSizer)
self.Fit()
self.Bind(wx.EVT_CLOSE, self.CloseWindow)
self.World = None
self.cdc = wx.ClientDC(self.panel)
w, h = self.panel.GetSize()
self.bmp = wx.EmptyBitmap(w,h)
self.timer = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.OnTimer)
self.timer.Start(20)
def __init__(self):
super(SignalKScope, self).__init__(None)
self.plot = SignalKPlot()
self.glContext = wx.glcanvas.GLContext(self.glArea)
self.client = SignalKClientFromArgs(sys.argv[:2], True, self.on_con)
self.host_port = self.client.host_port
self.client.autoreconnect = False
self.value_list = self.client.list_values()
self.plot.init(self.value_list)
self.watches = {}
watches = sys.argv[2:]
for name in sorted(self.value_list):
if self.value_list[name]['type'] != 'SensorValue':
continue
i = self.clValues.Append(name)
self.watches[name] = False
for arg in watches:
if arg == name:
self.clValues.Check(i, True)
self.watches[name] = True
watches.remove(name)
for arg in watches:
print 'value not found:', arg
self.on_con(self.client)
self.timer = wx.Timer(self, wx.ID_ANY)
self.Bind(wx.EVT_TIMER, self.receive_messages, id=wx.ID_ANY)
self.timer.Start(100)
self.sTime.SetValue(self.plot.disptime)
self.plot_reshape = False
def __init__(self):
super(CalibrationDialog, self).__init__(None)
self.host = ''
if len(sys.argv) > 1:
self.host = sys.argv[1]
self.client = False
self.compass_calibration_plot = compass_calibration_plot.CompassCalibrationPlot()
self.compass_calibration_glContext = wx.glcanvas.GLContext(self.CompassCalibration)
self.boat_plot = boatplot.BoatPlot()
self.boat_plot_glContext = wx.glcanvas.GLContext(self.BoatPlot)
self.dsServoMaxCurrent.SetIncrement(.1)
self.dsServoMaxCurrent.SetDigits(1)
self.dsServoMaxCurrent.Bind( wx.EVT_SPINCTRLDOUBLE, self.onMaxCurrent )
self.lastmouse = False
self.alignment_count = 0
self.timer = wx.Timer(self, self.ID_MESSAGES)
self.timer.Start(50)
self.Bind(wx.EVT_TIMER, self.receive_messages, id=self.ID_MESSAGES)
self.servo_timer = wx.Timer(self, self.ID_CALIBRATE_SERVO)
self.Bind(wx.EVT_TIMER, self.calibrate_servo_timer, id=self.ID_CALIBRATE_SERVO)
self.servoprocess = False
self.alignmentQ = [1, 0, 0, 0]
self.fusionQPose = [1, 0, 0, 0]
def __init__(self, parent):
wx.Dialog.__init__(self, parent, title="FestEngine Log", style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
main_sizer = wx.BoxSizer(wx.VERTICAL)
self.text_ctrl = wx.TextCtrl(self, style=wx.TE_READONLY | wx.TE_MULTILINE)
main_sizer.Add(self.text_ctrl, 1, wx.EXPAND)
self.pending_messages = list()
self.timer = wx.Timer()
self.timer.Bind(wx.EVT_TIMER, self.append_pending_messages)
self.timer.Start(500)
self.SetSizer(main_sizer)
def __init__(self, parent, run, api):
"""Initialize the RunPanel.
Args:
parent: The parent Window for this panel.
run: The sequencing run that should be displayed.
api: An initialized instance of an API for interacting with IRIDA.
"""
ScrolledPanel.__init__(self, parent, style=wx.SUNKEN_BORDER)
box = wx.StaticBox(self, label=run.sample_sheet_name)
self._timer = wx.Timer(self)
self._run = run
self._progress_value = 0
self._last_progress = 0
self._last_timer_progress = 0
self._sample_panels = {}
# the current overall progress for the run is calculated as a percentage
# of the total file size of all samples in the run.
self._progress_max = sum(sample.get_files_size() for sample in run.samples_to_upload)
logging.info("Total file size for run is {}".format(self._progress_max))
self._sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
pub.subscribe(self._upload_started, run.upload_started_topic)
pub.subscribe(self._handle_progress, run.upload_progress_topic)
pub.subscribe(self._upload_complete, run.upload_completed_topic)
pub.subscribe(self._upload_failed, run.upload_failed_topic)
for sample in run.sample_list:
self._sample_panels[sample.get_id()] = SamplePanel(self, sample, run, api)
self._sizer.Add(self._sample_panels[sample.get_id()], flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)
self.SetSizer(self._sizer)
self.Bind(wx.EVT_TIMER, self._update_progress_timer, self._timer)
self.Layout()
self.SetupScrolling()
ProcessingPlaceholderText.py 文件源码
项目:irida-miseq-uploader
作者: phac-nml
项目源码
文件源码
阅读 20
收藏 0
点赞 0
评论 0
def __init__(self, parent, *args, **kwargs):
wx.StaticText.__init__(self, parent, *args, **kwargs)
self._timer = wx.Timer(self)
self._current_char = 0
# this is the only font face on windows that actually renders the clock faces correctly.
self.SetFont(wx.Font(pointSize=wx.DEFAULT, family=wx.FONTFAMILY_DEFAULT, style=wx.NORMAL, weight=wx.FONTWEIGHT_NORMAL, face="Segoe UI Symbol"))
self.Bind(wx.EVT_TIMER, self._update_progress_text, self._timer)
self.Restart()
def initTextStim(self):
self.stimArea = widgets.TextStim(self, stimText='',
stimColor=self.stimColor, stimFont=self.stimFont)
self.stimTimer = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.changeStim, self.stimTimer)
def __init__(self, *args, **kwargs):
self.paused = False # pause the plot without stopping data acquisition
self.refreshDelay = 50.0 # milliseconds between plot updates, does not include draw time
self.recordingTime = None # start time for EEG recording, None indicates not started
StandardPage.__init__(self, *args, **kwargs)
# wx timer for updating the monitor plot
self.updateTimer = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.runUpdatePlot, self.updateTimer)
def initStatusBar(self):
"""Initialize main status bar.
"""
nFields = 5
self.statusBar = self.CreateStatusBar()
self.statusBar.SetFieldsCount(nFields)
self.statusBar.SetStatusStyles([wx.SB_FLAT]*nFields)
# update status bar at least once per second
self.updateStatusTimer = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.updateStatusBar, id=self.updateStatusTimer.GetId())
self.updateStatusTimer.Start(1000*1)
def initCollect(self):
self.collecting = False
self.rawView = True
self.collectRefreshDelay = 0.025
self.collectTimer = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.updateTrace, self.collectTimer)
def initRefreshTimer(self):
self.refreshTimer = wx.Timer(self) # timer to update game state
self.Bind(wx.EVT_TIMER, self.update, self.refreshTimer) # handle timer events
self.bindKeyboard()
self.refreshTimer.Start(30.0)
def set_events(self):
'''
@summary: Create button and timer events for GUI
'''
# Create and bind timer event
self.key_destruction_timer = wx.Timer()
self.key_destruction_timer.SetOwner( self, wx.ID_ANY )
self.key_destruction_timer.Start( 500 )
self.Bind(wx.EVT_TIMER, self.blink, self.key_destruction_timer)
# Create button events
self.Bind(wx.EVT_BUTTON, self.show_encrypted_files, self.ViewEncryptedFilesButton)
self.Bind(wx.EVT_BUTTON, self.show_decryption_dialog, self.EnterDecryptionKeyButton)
self.Bind(wx.EVT_BUTTON, self.open_url, self.BitcoinButton)
def __init__(self, parent):
wx.Panel.__init__(self, parent)
self.ancestor = parent
self.filename = ""
self.dirname = '.'
self.vbox = wx.BoxSizer(wx.VERTICAL)
self.log= wx.TextCtrl(self, style=wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL)
self.vbox.Add(self.log, 1, wx.EXPAND | wx.ALL, 2)
self.vbox.AddSpacer(2)
self.hbox_ent = wx.BoxSizer(wx.HORIZONTAL)
self.hbox_ent.AddSpacer(20)
self.font = self.ancestor.GetParent().font
self.label = wx.StaticText(self, -1,"Log Entry:", style=wx.ALIGN_CENTRE_HORIZONTAL, size=(160,-1) )
self.label.SetFont(self.font)
self.hbox_ent.Add( self.label, 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 2)
self.entry = wx.TextCtrl(self, -1, style=wx.TE_PROCESS_ENTER)
self.entry.SetFont(self.font)
self.entry.SetValue("")
if IsNotWX4():
self.entry.SetToolTipString("Enter comments into the log here.")
else:
self.entry.SetToolTip("Enter comments into the log here.")
self.entry.Bind(wx.EVT_TEXT_ENTER, self.OnEnterComments)
self.hbox_ent.Add( self.entry, 1, wx.EXPAND | wx.LEFT | wx.RIGHT)
self.vbox.Add(self.hbox_ent, 0, wx.EXPAND)
self.hbox_btn = wx.BoxSizer(wx.HORIZONTAL)
self.hbox_btn.AddSpacer(20)
self.button_save =wx.Button(self, label="Save Log")
self.Bind(wx.EVT_BUTTON, self.OnClickSaveButton, self.button_save)
self.hbox_btn.Add(self.button_save)
self.button_clear =wx.Button(self, label="Clear Log")
self.Bind(wx.EVT_BUTTON, self.OnClickClearButton, self.button_clear)
self.hbox_btn.Add(self.button_clear)
self.vbox.Add(self.hbox_btn, 0, wx.EXPAND)
self.SetSizerAndFit(self.vbox)
self.redir=RedirectText(self.log)
sys.stdout=self.redir
self.data_poll_timer = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.UpdateLog, self.data_poll_timer)
def __init__(self, parent):
wx.Panel.__init__(self, parent)
self.ancestor = parent
self.fontpointsize=wx.SystemSettings.GetFont(wx.SYS_SYSTEM_FONT).GetPointSize()
self.colour = wx.Colour(30,70,115, alpha=wx.ALPHA_OPAQUE)
self.canvas = PlotCanvas(self)
if IsNotWX4():
self.canvas.SetInitialSize(size=self.GetClientSize())
self.canvas.SetShowScrollbars(True)
self.canvas.SetEnableZoom(False)
self.canvas.SetFontSizeAxis(point=12)
self.canvas.SetFontSizeTitle(point=12)
self.canvas.SetGridColour(wx.Colour(0, 0, 0))
self.canvas.SetForegroundColour(wx.Colour(0, 0, 0))
self.canvas.SetBackgroundColour(wx.Colour(255, 255, 255))
else:
self.canvas.axesPen = wx.Pen(self.colour, width=1, style=wx.PENSTYLE_SOLID)
self.canvas.SetForegroundColour(wx.Colour(0, 0, 0))
self.canvas.SetBackgroundColour(wx.Colour(255, 255, 255))
self.canvas.enableGrid = (True,True)
self.canvas.fontSizeAxis = self.fontpointsize
self.canvas.fontSizeTitle = self.fontpointsize
self.vbox = wx.BoxSizer(wx.VERTICAL)
self.vbox.Add(self.canvas, 1, flag=wx.LEFT | wx.TOP | wx.GROW)
self.paused = False
self.hbox_btn = wx.BoxSizer(wx.HORIZONTAL)
self.hbox_btn.AddSpacer(20)
self.button_pause =wx.Button(self, label="Pause Graph")
self.Bind(wx.EVT_BUTTON, self.OnClickPauseButton, self.button_pause)
self.hbox_btn.Add(self.button_pause)
self.button_save =wx.Button(self, label="Save Data")
self.Bind(wx.EVT_BUTTON, self.OnClickSaveButton, self.button_save)
self.hbox_btn.Add(self.button_save)
self.vbox.Add(self.hbox_btn, 0, wx.EXPAND)
self.SetSizer(self.vbox)
self.Fit()
self.Show()
self.data_poll_timer = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.UpdateGraph, self.data_poll_timer)
def __init__(self, parent, id=wx.ID_ANY, style=wx.ALIGN_LEFT, size=(-1,-1), spinfunc=None):
wx.Panel.__init__(self, parent)
self.hbox = wx.BoxSizer(wx.HORIZONTAL)
self.buttonP = wx.Button(self, -1, label="+", size=size)
self.buttonM = wx.Button(self, -1, label="-", size=size)
self.buttonP.Bind(wx.EVT_BUTTON, self.OnP)
self.buttonM.Bind(wx.EVT_BUTTON, self.OnM)
self.repeatTimerP = wx.Timer(self)
self.repeatTimerM = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.RepeatValueP, self.repeatTimerP)
self.Bind(wx.EVT_TIMER, self.RepeatValueM, self.repeatTimerM)
self.buttonP.Bind(wx.EVT_LEFT_DOWN, self.OnButPDown)
self.buttonM.Bind(wx.EVT_LEFT_DOWN, self.OnButMDown)
self.buttonP.Bind(wx.EVT_LEFT_UP, self.OnButPUp)
self.buttonM.Bind(wx.EVT_LEFT_UP, self.OnButMUp)
self.hbox.Add(self.buttonM, 0)
self.hbox.Add(self.buttonP, 0)
self.SetSizer(self.hbox)
self.Fit()
self.Layout()
self.Show()
self.max = 0
self.min = 0
self.range = 0
self.value = 0
self.SpinFunc = spinfunc
self.n = 1
self.t1 = time()
self.t2 = time()
def __init__(self):
wx.Frame.__init__(self, None, title=u"????",pos=(545,200),size=(420,150))
self.panelOne = PanelOne(self)
self.time2die = 5
self.timer = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.update, self.timer)
self.timer.Start(1000)
self.sizer = wx.BoxSizer(wx.VERTICAL)
self.sizer.Add(self.panelOne, 1, wx.EXPAND)
self.SetSizer(self.sizer)
def __init__(self, parent, file):
super(WaveformPlot, self).__init__(parent=parent, title="pyjam Waveform Viewer",
style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
self.file = file
self.plot = plot.PlotCanvas(self)
self.plot.canvas.Bind(wx.EVT_LEFT_DOWN, self.lmb_down)
self.plot.canvas.Bind(wx.EVT_LEFT_UP, self.lmb_up)
self.plot.canvas.Bind(wx.EVT_MOTION, self.mouse_motion)
self.plot.EnableAxesValues = (True, False, False, False)
self.plot.EnableGrid = (True, False)
self.plot.AbsScale = (True, False)
self.plot.EnableAntiAliasing = True
self.panel = WaveformPanel(self)
sizer = wx.BoxSizer(wx.HORIZONTAL)
sizer.Add(self.plot, 1, wx.EXPAND, 0)
sizer.Add(self.panel, 0, wx.EXPAND, 0)
self.SetSizerAndFit(sizer)
self.SetSize(800, self.GetSize()[1])
self.SetMinSize(self.GetSize())
self.player = wx.media.MediaCtrl(parent=self, style=wx.SIMPLE_BORDER)
self.volume = 25
self.selected = np.array([0.0, 0.0])
self.maximum = 0.0
self.minimum = 0.0
self.selection_drawn = False
self.resized = False
self.timer = wx.Timer(self)
self.Bind(wx.EVT_SIZE, self.on_size)
self.Bind(wx.EVT_TIMER, self.on_timer)
self.Bind(wx.EVT_IDLE, self.on_idle)
self.Bind(wx.EVT_CLOSE, self.on_exit)
self.load()
def SetAppFrame(self, frame, logger):
self.AppFrame = frame
self.logger = logger
self.StatusTimer = None
if self.DispatchDebugValuesTimer is not None:
self.DispatchDebugValuesTimer.Stop()
self.DispatchDebugValuesTimer = None
if frame is not None:
# Timer to pull PLC status
self.StatusTimer = wx.Timer(self.AppFrame, -1)
self.AppFrame.Bind(wx.EVT_TIMER,
self.PullPLCStatusProc,
self.StatusTimer)
if self._connector is not None:
frame.LogViewer.SetLogSource(self._connector)
self.StatusTimer.Start(milliseconds=500, oneShot=False)
# Timer to dispatch debug values to consumers
self.DispatchDebugValuesTimer = wx.Timer(self.AppFrame, -1)
self.AppFrame.Bind(wx.EVT_TIMER,
self.DispatchDebugValuesProc,
self.DispatchDebugValuesTimer)
self.RefreshConfNodesBlockLists()
def ResetAppFrame(self, logger):
if self.AppFrame is not None:
self.AppFrame.Unbind(wx.EVT_TIMER, self.StatusTimer)
self.StatusTimer = None
self.AppFrame = None
self.KillDebugThread()
self.logger = logger