import urllib2 import logging import urlparse import os import time import tempfile import shutil import contextlib import wx import subprocess from wx import wxEVT_CLOSE_WINDOW import sys import urllib import re UpgradeEventType = wx.NewEventType() EVT_UPGRADE_EVENT = wx.PyEventBinder(UpgradeEventType, 1) class UpgradeEvent(wx.PyCommandEvent): def __init__(self, updater): wx.PyCommandEvent.__init__(self, UpgradeEventType, wx.ID_ANY) self._updater = updater def get_updater(self): return self._updater class EDUpdater(object): def __init__(self, parent, latest_url, version):
Version 0.4 """ __docformat__ = "epytext" import wx import math # Flag to use double buffering (recommendeded = 1) KC_BUFFERED_DC = 1 """Flag to use double buffering (recommendeded = 1)""" # Events wxEVT_KC_ANGLE_CHANGING = wx.NewEventType() wxEVT_KC_ANGLE_CHANGED = wx.NewEventType() EVT_KC_ANGLE_CHANGING = wx.PyEventBinder(wxEVT_KC_ANGLE_CHANGING, 1) """ Notify the client that the knob is changing its value.""" EVT_KC_ANGLE_CHANGED = wx.PyEventBinder(wxEVT_KC_ANGLE_CHANGED, 1) """ Notify the client that the knob has changed its value.""" # ---------------------------------------------------------------------------- # # Class KnobCtrlEvent # ---------------------------------------------------------------------------- # class KnobCtrlEvent(wx.CommandEvent): """ Represent details of the events that the :class:`KnobCtrl` object sends.
import wx import wx.lib.delayedresult as delayedresult # threading in wx import config import icons import wizard import widgets import gdalpreprocess from bug_report import do_bug_report_dialog import wxgdal2tiles as wxgdal # TODO: GetText _ = lambda s: s GENERIC_GUI_EVENT = wx.NewEventType() EVT_GENERIC_GUI = wx.PyEventBinder(GENERIC_GUI_EVENT, 0) class GenericGuiEvent(wx.PyEvent): def __init__(self, data=None): wx.PyEvent.__init__(self) self.SetEventType(GENERIC_GUI_EVENT) self.data = data class MainFrame(wx.Frame): def __init__(self, *args, **kwds): #spath = wx.StandardPaths.Get() #config.documentsdir = spath.GetDocumentsDir()
if parent is None or child == self.painter.tree.currentRoot: px = (child.projx - self.painter.tree.layout.NODE_STEP) + 5 py = child.projy + self.painter.tree.layout.NODE_HEIGHT/2 -2 cx = child.projx cy = py dc.DrawLine(px, py, cx, cy) else: px = parent.projx + 5 py = parent.projy + parent.height cx = child.projx -5 cy = child.projy + self.painter.tree.layout.NODE_HEIGHT/2 -3 dc.DrawLine(px, py, px, cy) dc.DrawLine(px, cy, cx, cy) #>> Event defs wxEVT_MVCTREE_BEGIN_EDIT = wx.NewEventType() #Start editing. Vetoable. wxEVT_MVCTREE_END_EDIT = wx.NewEventType() #Stop editing. Vetoable. wxEVT_MVCTREE_DELETE_ITEM = wx.NewEventType() #Item removed from model. wxEVT_MVCTREE_ITEM_EXPANDED = wx.NewEventType() wxEVT_MVCTREE_ITEM_EXPANDING = wx.NewEventType() wxEVT_MVCTREE_ITEM_COLLAPSED = wx.NewEventType() wxEVT_MVCTREE_ITEM_COLLAPSING = wx.NewEventType() wxEVT_MVCTREE_SEL_CHANGED = wx.NewEventType() wxEVT_MVCTREE_SEL_CHANGING = wx.NewEventType() #Vetoable. wxEVT_MVCTREE_KEY_DOWN = wx.NewEventType() wxEVT_MVCTREE_ADD_ITEM = wx.NewEventType() #Item added to model. EVT_MVCTREE_SEL_CHANGED = wx.PyEventBinder(wxEVT_MVCTREE_SEL_CHANGED, 1) EVT_MVCTREE_SEL_CHANGING = wx.PyEventBinder(wxEVT_MVCTREE_SEL_CHANGING, 1) EVT_MVCTREE_ITEM_EXPANDED = wx.PyEventBinder(wxEVT_MVCTREE_ITEM_EXPANDED, 1) EVT_MVCTREE_ITEM_EXPANDING = wx.PyEventBinder(wxEVT_MVCTREE_ITEM_EXPANDING, 1)
ctrl.SetItemState(n, SEL_FOC, SEL_FOC) def getListCtrlSelection(listctrl, state=wx.LIST_STATE_SELECTED): """ Returns list of item indexes of given state (selected by defaults) """ res = [] idx = -1 while 1: idx = listctrl.GetNextItem(idx, wx.LIST_NEXT_ALL, state) if idx == -1: break res.append(idx) return res wxEVT_DOPOPUPMENU = wx.NewEventType() EVT_DOPOPUPMENU = wx.PyEventBinder(wxEVT_DOPOPUPMENU, 0) class ListCtrlSelectionManagerMix: """Mixin that defines a platform independent selection policy As selection single and multi-select list return the item index or a list of item indexes respectively. """ _menu = None def __init__(self): self.Bind(wx.EVT_RIGHT_DOWN, self.OnLCSMRightDown) self.Bind(EVT_DOPOPUPMENU, self.OnLCSMDoPopup) # self.Connect(-1, -1, self.wxEVT_DOPOPUPMENU, self.OnLCSMDoPopup)
def _EventMaker(): evt = wx.NewEventType() return (evt, wx.PyEventBinder(evt))
CAPTION_SIZE = 9 # user = os.getlogin() # icons = os.path.join(os.path.dirname(os.path.abspath(ct.__file__)), 'icons/') def str_split(string, delimiters=(' ', ','), maxsplit=0): import re rexp = '|'.join(map(re.escape, delimiters)) return re.split(rexp, string, maxsplit) # -------------------------------- Threading --------------------------------- # # Set up events for finishing one cycle and for finishing all cycles tp_EVT_ALLDONE = wx.NewEventType() EVT_ALLDONE = wx.PyEventBinder(tp_EVT_ALLDONE, 1) class AllDone(wx.PyCommandEvent): ''' Send event when finished all cycles ''' def __init__(self, etype, eid): wx.PyCommandEvent.__init__(self, etype, eid) class PRIMEThread(Thread): ''' Worker thread; generated so that the GUI does not lock up when processing is running ''' def __init__(self, parent, prime_file,
See Also ======== L{RibbonPage}, L{RibbonPanel} """ import wx import types from control import RibbonControl from art_internal import RibbonPageTabInfo from art_msw import RibbonMSWArtProvider from art import * wxEVT_COMMAND_RIBBONBAR_PAGE_CHANGED = wx.NewEventType() wxEVT_COMMAND_RIBBONBAR_PAGE_CHANGING = wx.NewEventType() wxEVT_COMMAND_RIBBONBAR_TAB_MIDDLE_DOWN = wx.NewEventType() wxEVT_COMMAND_RIBBONBAR_TAB_MIDDLE_UP = wx.NewEventType() wxEVT_COMMAND_RIBBONBAR_TAB_RIGHT_DOWN = wx.NewEventType() wxEVT_COMMAND_RIBBONBAR_TAB_RIGHT_UP = wx.NewEventType() EVT_RIBBONBAR_PAGE_CHANGED = wx.PyEventBinder( wxEVT_COMMAND_RIBBONBAR_PAGE_CHANGED, 1) EVT_RIBBONBAR_PAGE_CHANGING = wx.PyEventBinder( wxEVT_COMMAND_RIBBONBAR_PAGE_CHANGING, 1) EVT_RIBBONBAR_TAB_MIDDLE_DOWN = wx.PyEventBinder( wxEVT_COMMAND_RIBBONBAR_TAB_MIDDLE_DOWN, 1) EVT_RIBBONBAR_TAB_MIDDLE_UP = wx.PyEventBinder( wxEVT_COMMAND_RIBBONBAR_TAB_MIDDLE_UP, 1) EVT_RIBBONBAR_TAB_RIGHT_DOWN = wx.PyEventBinder(
import wx import numpy import threading import time EVT_NEW_IMAGE = wx.PyEventBinder(wx.NewEventType(), 0) class ImageWindow(wx.Window): def __init__(self, parent, id=-1, style=wx.FULL_REPAINT_ON_RESIZE): wx.Window.__init__(self, parent, id, style=style) self.timer = wx.Timer self.img = wx.EmptyImage(2, 2) self.bmp = self.img.ConvertToBitmap() self.clientSize = self.GetClientSize() self.Bind(wx.EVT_PAINT, self.OnPaint) #For video support #------------------------------------------------------------ self.Bind(EVT_NEW_IMAGE, self.OnNewImage) self.eventLock = None self.pause = False #------------------------------------------------------------ def OnPaint(self, event): size = self.GetClientSize() if (size == self.clientSize): self.PaintBuffer()
import wx VIEWSELECTIONEVENT = wx.NewEventType() VIEWBLOGPOSTSFILTERCHANGEDEVENT = wx.NewEventType() VIEWLINKSFILTERCHANGEDEVENT = wx.NewEventType() VIEWIMAGESFILTERCHANGEDEVENT = wx.NewEventType() VIEWTAGSFILTERCHANGEDEVENT = wx.NewEventType() ZEVT_VIEW_SELECTION_CHANGED = wx.PyEventBinder(VIEWSELECTIONEVENT, 0) ZEVT_VIEW_BLOG_POSTS_FILTER_CHANGED = wx.PyEventBinder( VIEWBLOGPOSTSFILTERCHANGEDEVENT, 0) ZEVT_VIEW_LINKS_FILTER_CHANGED = wx.PyEventBinder(VIEWLINKSFILTERCHANGEDEVENT, 0) ZEVT_VIEW_IMAGES_FILTER_CHANGED = wx.PyEventBinder( VIEWIMAGESFILTERCHANGEDEVENT, 0) ZEVT_VIEW_TAGS_FILTER_CHANGED = wx.PyEventBinder(VIEWTAGSFILTERCHANGEDEVENT, 0) # ---------------------------------------------------------------------------- # Custom event class. # ---------------------------------------------------------------------------- class ZViewEvent(wx.PyCommandEvent): def __init__(self, eventType, view): self.view = view self.eventType = eventType wx.PyCommandEvent.__init__(self, self.eventType) #end __init__() def getView(self): return self.view
Event Name Description ======================================== ======================================== ``EVT_RIBBONBUTTONBAR_CLICKED`` Triggered when the normal (non-dropdown) region of a button on the button bar is clicked. ``EVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED`` Triggered when the dropdown region of a button on the button bar is clicked. :meth:`RibbonButtonBarEvent.PopupMenu() <RibbonButtonBarEvent.PopupMenu>` should be called by the event handler if it wants to display a popup menu (which is what most dropdown buttons should be doing). ======================================== ======================================== """ import wx import six from .control import RibbonControl from .art import * wxEVT_COMMAND_RIBBONBUTTON_CLICKED = wx.NewEventType() wxEVT_COMMAND_RIBBONBUTTON_DROPDOWN_CLICKED = wx.NewEventType() EVT_RIBBONBUTTONBAR_CLICKED = wx.PyEventBinder(wxEVT_COMMAND_RIBBONBUTTON_CLICKED, 1) EVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED = wx.PyEventBinder(wxEVT_COMMAND_RIBBONBUTTON_DROPDOWN_CLICKED, 1) class RibbonButtonBarButtonSizeInfo: def __init__(self): self.is_supported = True self.size = wx.Size() self.normal_region = wx.Rect() self.dropdown_region = wx.Rect()
except IOError: # handling the case when there are no raw files print "No RAW input to parse in %s" % self.path class SeqGenCommand(Command): def __init__(self, seq, config, gen): super(SeqGenCommand, self).__init__() self.seq = seq self.gen = gen self.config = config def __call__(self): return self.gen(self.seq, self.config) wxEVT_COMMAND_UPDATE = wx.NewEventType() EVT_COMMAND_UPDATE = wx.PyEventBinder(wxEVT_COMMAND_UPDATE, 1) class CommandUpdate(wx.PyCommandEvent): def __init__(self, callback): super(CommandUpdate, self).__init__(wxEVT_COMMAND_UPDATE, 0) # Attributes self.value = None self.callback = callback self.result = 'Failed' self.task_id = None def SetValue(self, value): self.value = value
def dprint(txt=""): print txt class debugmixin(object): debuglevel = 0 def dprint(self, txt): if self.debuglevel > 0: dprint(txt) #(NeXTPanelEvent, EVT_NEXTPANEL) = wx.lib.newevent.NewEvent() # FIXME: the newevent.NewEvent() style didn't work; had to grab the # PyCommandEvent pattern from the demo. myEVT_NEXTPANEL = wx.NewEventType() EVT_NEXTPANEL = wx.PyEventBinder(myEVT_NEXTPANEL, 1) class NeXTPanelEvent(wx.PyCommandEvent): def __init__(self): wx.PyCommandEvent.__init__(self, myEVT_NEXTPANEL, id=-1) self.list = None self.listnum = None class NeXTList(wx.ListBox): def __init__(self, parent, *args, **kw): wx.ListBox.__init__(self, parent, *args, **kw) def DeleteAllItems(self):
import sys import wx from leginon.gui.wx.Choice import Choice from leginon.gui.wx.Entry import FloatEntry, IntEntry, EVT_ENTRY from leginon.gui.wx.Presets import EditPresetOrder import leginon.gui.wx.Acquisition import leginon.gui.wx.Dialog import leginon.gui.wx.Events import leginon.gui.wx.Icons import leginon.gui.wx.ImagePanel import leginon.gui.wx.TargetPanel import leginon.gui.wx.ToolBar import leginon.gui.wx.ManualFocus UpdateImagesEventType = wx.NewEventType() ManualCheckEventType = wx.NewEventType() ManualCheckDoneEventType = wx.NewEventType() AlignRotationCenterEventType = wx.NewEventType() EVT_UPDATE_IMAGES = wx.PyEventBinder(UpdateImagesEventType) EVT_MANUAL_CHECK = wx.PyEventBinder(ManualCheckEventType) EVT_MANUAL_CHECK_DONE = wx.PyEventBinder(ManualCheckDoneEventType) EVT_ALIGN = wx.PyEventBinder(AlignRotationCenterEventType) class UpdateImagesEvent(wx.PyCommandEvent): def __init__(self, source): wx.PyCommandEvent.__init__(self, UpdateImagesEventType, source.GetId()) self.SetEventObject(source) class ManualCheckEvent(wx.PyCommandEvent):
# QUALQUER GARANTIA; sem mesmo a garantia implicita de # COMERCIALIZACAO ou de ADEQUACAO A QUALQUER PROPOSITO EM # PARTICULAR. Consulte a Licenca Publica Geral GNU para obter mais # detalhes. #-------------------------------------------------------------------------- import wx import wx.gizmos as gizmos from wx.lib.pubsub import pub as Publisher import wx.lib.splitter as spl import invesalius.constants as const import invesalius.gui.dialogs as dlg import invesalius.gui.dicom_preview_panel as dpp import invesalius.reader.dicom_grouper as dcm myEVT_SELECT_SERIE = wx.NewEventType() EVT_SELECT_SERIE = wx.PyEventBinder(myEVT_SELECT_SERIE, 1) myEVT_SELECT_SLICE = wx.NewEventType() EVT_SELECT_SLICE = wx.PyEventBinder(myEVT_SELECT_SLICE, 1) myEVT_SELECT_PATIENT = wx.NewEventType() EVT_SELECT_PATIENT = wx.PyEventBinder(myEVT_SELECT_PATIENT, 1) myEVT_SELECT_SERIE_TEXT = wx.NewEventType() EVT_SELECT_SERIE_TEXT = wx.PyEventBinder(myEVT_SELECT_SERIE_TEXT, 1) class SelectEvent(wx.PyCommandEvent): def __init__(self, evtType, id): super(SelectEvent, self).__init__(evtType, id)
======================================= =================================== See Also ======== :class:`~wx.lib.agw.ribbon.page.RibbonPage` """ import wx from .control import RibbonControl from .art import * wxEVT_COMMAND_RIBBONPANEL_EXTBUTTON_ACTIVATED = wx.NewEventType() EVT_RIBBONPANEL_EXTBUTTON_ACTIVATED = wx.PyEventBinder( wxEVT_COMMAND_RIBBONPANEL_EXTBUTTON_ACTIVATED, 1) def IsAncestorOf(ancestor, window): while window is not None: parent = window.GetParent() if parent == ancestor: return True else: window = parent return False
'edEVT_SB_PAGE_CHANGING', 'EVT_SB_PAGE_CHANGING', 'edEVT_SB_PAGE_CHANGED', 'EVT_SB_PAGE_CHANGED', 'edEVT_SB_PAGE_CLOSED', 'EVT_SB_PAGE_CLOSED', 'edEVT_SB_PAGE_CONTEXT_MENU', 'EVT_SB_PAGE_CONTEXT_MENU', 'edEVT_SB_PAGE_CLOSING', 'EVT_SB_PAGE_CLOSING' ] #-----------------------------------------------------------------------------# # Imports import wx # Local Imports import ctrlbox #-----------------------------------------------------------------------------# # Events edEVT_SB_PAGE_CHANGING = wx.NewEventType() EVT_SB_PAGE_CHANGING = wx.PyEventBinder(edEVT_SB_PAGE_CHANGING, 1) edEVT_SB_PAGE_CHANGED = wx.NewEventType() EVT_SB_PAGE_CHANGED = wx.PyEventBinder(edEVT_SB_PAGE_CHANGED, 1) edEVT_SB_PAGE_CLOSING = wx.NewEventType() EVT_SB_PAGE_CLOSING = wx.PyEventBinder(edEVT_SB_PAGE_CLOSING, 1) edEVT_SB_PAGE_CLOSED = wx.NewEventType() EVT_SB_PAGE_CLOSED = wx.PyEventBinder(edEVT_SB_PAGE_CLOSED, 1) edEVT_SB_PAGE_CONTEXT_MENU = wx.NewEventType() EVT_SB_PAGE_CONTEXT_MENU = wx.PyEventBinder(edEVT_SB_PAGE_CONTEXT_MENU, 1) class SegmentBookEvent(wx.NotebookEvent): """SegmentBook event"""
#! /usr/bin/env python import wx import wx.lib.plot as plot import pysos import sys from threading import Lock import time import struct sys.stderr = open("stderr", "w") EVT_RESULT_ID = wx.NewEventType() class ResultEvent(wx.PyEvent): """Simple event to carry arbitrary result data.""" def __init__(self, data): """Init Result Event.""" wx.PyEvent.__init__(self) self.SetEventType(EVT_RESULT_ID) self.data = data class SensorDataFrame(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title, size=(510, 340)) self.panel = wx.Panel(self) self.Center() # Initialize a Box to hold all the graph plots self.box = wx.BoxSizer(wx.VERTICAL) # Initialize dictionary of graph plots along with corresponding sensor id
from enum import Enum, auto import wx class CalibrationEventType(Enum): SHOW_POINT = auto() UPDATE_USER_POSITION = auto() FINALIZING_CALIBRATION = auto() CALIBRATION_CONCLUDED = auto() SHOW_POINT = CalibrationEventType.SHOW_POINT UPDATE_USER_POSITION = CalibrationEventType.UPDATE_USER_POSITION FINALIZING_CALIBRATION = CalibrationEventType.FINALIZING_CALIBRATION CALIBRATION_CONCLUDED = CalibrationEventType.CALIBRATION_CONCLUDED EVT_TYPE_CALIBRATION = wx.NewEventType() EVT_CALIBRATION = wx.PyEventBinder(EVT_TYPE_CALIBRATION) EVT_TYPE_CLOSE_APP = wx.NewEventType() EVT_CLOSE_APP = wx.PyEventBinder(EVT_TYPE_CLOSE_APP) class CalibrationEvent(wx.PyCommandEvent): def __init__(self, point=None): wx.PyCommandEvent.__init__(self, EVT_TYPE_CALIBRATION, -1) class CloseAppEvent(wx.PyCommandEvent): def __init__(self): wx.PyCommandEvent.__init__(self, EVT_TYPE_CLOSE_APP, -1) class ShowPointEvent(CalibrationEvent): def __init__(self, point, success_count=0):
SEGBTN_OPT_NONE = 1 # No options set. SEGBTN_OPT_CLOSEBTNL = 2 # Close button on the segments left side. SEGBTN_OPT_CLOSEBTNR = 4 # Close button on the segment right side. # Hit test locations SEGMENT_HT_NOWHERE = 0 SEGMENT_HT_SEG = 1 SEGMENT_HT_X_BTN = 2 # Segment States SEGMENT_STATE_NONE = 0 # Hover no where SEGMENT_STATE_SEG = 1 # Hover on segment SEGMENT_STATE_X = 2 # Hover on segment x button # ControlBar event for items added by AddTool edEVT_CTRLBAR = wx.NewEventType() EVT_CTRLBAR = wx.PyEventBinder(edEVT_CTRLBAR, 1) class ControlBarEvent(wx.PyCommandEvent): """ControlBar Button Event""" edEVT_SEGMENT_SELECTED = wx.NewEventType() EVT_SEGMENT_SELECTED = wx.PyEventBinder(edEVT_SEGMENT_SELECTED, 1) edEVT_SEGMENT_CLOSE = wx.NewEventType() EVT_SEGMENT_CLOSE = wx.PyEventBinder(edEVT_SEGMENT_CLOSE, 1) class SegmentBarEvent(wx.PyCommandEvent): """SegmentBar Button Event"""
app = wx.App() frame = MyFrame(None, 'Select a colour') frame.Show() app.MainLoop() """ # ---------------------------------------------------------------------------- import wx import wx.lib.buttons # ---------------------------------------------------------------------------- wxEVT_COMMAND_COLOURSELECT = wx.NewEventType() class ColourSelectEvent(wx.PyCommandEvent): """ :class:`wx.ColourSelectEvent` is a special subclassing of :class:`wx.CommandEvent` and it provides for a custom event sent every time the user chooses a colour. """ def __init__(self, id, value): """ Default class constructor. :param integer `id`: the event identifier; :param wx.Colour `value`: the colour currently selected. """
from matplotlib import pyplot class MyEvent(wx.PyCommandEvent): # 1 定义事件 def __init__(self, evtType, id): wx.PyCommandEvent.__init__(self, evtType, id) self.eventArgs = "" def GetEventArgs(self): return self.eventArgs def SetEventArgs(self, args): self.eventArgs = args myEVT_MY_TEST = wx.NewEventType() # 2 创建一个事件类型 EVT_MY_TEST = wx.PyEventBinder(myEVT_MY_TEST, 1) # 3 创建一个绑定器对象 class MyFrame(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, title="京东图书爬虫程序", size=(700, 600)) panel = wx.Panel(self, -1) wx.StaticText(panel, label='商品ID:', pos=(1, 10), size=(60, 25)) self.goodsId = wx.TextCtrl(panel, pos=(65, 5), size=(100, 25)) self.submit1 = wx.Button(panel, label='爬取', pos=(180, 5), size=(60, 25)) self.Bind(wx.EVT_BUTTON, self.OnSubmit1Click, self.submit1)
#!/usr/bin/env python # -*- coding: utf-8 -*- # generated by wxGlade 0.6.3 on Thu Sep 2 15:32:04 2010 import wx wxEVT_FLOATCOMBO = wx.NewEventType() EVT_FLOATCOMBO = wx.PyEventBinder(wxEVT_FLOATCOMBO, 0) wxEVT_FLOATCOMBO_SPINUP = wx.NewEventType() EVT_FLOATCOMBO_SPINUP = wx.PyEventBinder(wxEVT_FLOATCOMBO_SPINUP, 0) wxEVT_FLOATCOMBO_SPINDOWN = wx.NewEventType() EVT_FLOATCOMBO_SPINDOWN = wx.PyEventBinder(wxEVT_FLOATCOMBO_SPINDOWN, 0) wxEVT_FLOATCOMBO_ENDSCROLL = wx.NewEventType() EVT_FLOATCOMBO_ENDSCROLL = wx.PyEventBinder(wxEVT_FLOATCOMBO_ENDSCROLL, 0) wxEVT_FLOATCOMBO_THUMTRACK = wx.NewEventType() EVT_FLOATCOMBO_THUMTRACK = wx.PyEventBinder(wxEVT_FLOATCOMBO_THUMTRACK, 0) wxEVT_FLOATCOMBO_PAGEUP = wx.NewEventType() EVT_FLOATCOMBO_PAGEUP = wx.PyEventBinder(wxEVT_FLOATCOMBO_PAGEUP, 0) wxEVT_FLOATCOMBO_PAGEDOWN = wx.NewEventType() EVT_FLOATCOMBO_PAGEDOWN = wx.PyEventBinder(wxEVT_FLOATCOMBO_PAGEDOWN, 0) wxEVT_FLOATCOMBO_LINEUP = wx.NewEventType() EVT_FLOATCOMBO_LINEUP = wx.PyEventBinder(wxEVT_FLOATCOMBO_LINEUP, 0) wxEVT_FLOATCOMBO_LINEDOWN = wx.NewEventType()
# # COPYRIGHT: # The Leginon software is Copyright 2003 # The Scripps Research Institute, La Jolla, CA # For terms of the license agreement # see http://ami.scripps.edu/software/leginon-license # import wx import sys import numpy import leginon.gui.wx.ImagePanelTools import leginon.gui.wx.TargetPanelBitmaps #import shortpath TargetingEventType = wx.NewEventType() EVT_TARGETING = wx.PyEventBinder(TargetingEventType) ShowNumbersEventType = wx.NewEventType() EVT_SHOWNUMBERS = wx.PyEventBinder(ShowNumbersEventType) ################################## ## ################################## class TargetingEvent(wx.PyCommandEvent): def __init__(self, source, name, value): wx.PyCommandEvent.__init__(self, TargetingEventType, source.GetId()) self.SetEventObject(source) self.name = name self.value = value
=================================== =================================== Event Name Description =================================== =================================== ``EVT_RIBBONGALLERY_SELECTED`` Triggered when the user selects an item from the gallery. Note that the ID is that of the gallery, not of the item. ``EVT_RIBBONGALLERY_HOVER_CHANGED`` Triggered when the item being hovered over by the user changes. The item in the event will be the new item being hovered, or ``None`` if there is no longer an item being hovered. Note that the ID is that of the gallery, not of the item. ``EVT_RIBBONGALLERY_CLICKED`` Triggered when the user clicks on an item in the gallery. ``EVT_BUTTON`` Triggered when the "extension" button of the gallery is pressed. =================================== =================================== """ import wx from control import RibbonControl from art import * wxEVT_COMMAND_RIBBONGALLERY_HOVER_CHANGED = wx.NewEventType() wxEVT_COMMAND_RIBBONGALLERY_SELECTED = wx.NewEventType() wxEVT_COMMAND_RIBBONGALLERY_CLICKED = wx.NewEventType() EVT_RIBBONGALLERY_HOVER_CHANGED = wx.PyEventBinder( wxEVT_COMMAND_RIBBONGALLERY_HOVER_CHANGED, 1) EVT_RIBBONGALLERY_SELECTED = wx.PyEventBinder( wxEVT_COMMAND_RIBBONGALLERY_SELECTED, 1) EVT_RIBBONGALLERY_CLICKED = wx.PyEventBinder( wxEVT_COMMAND_RIBBONGALLERY_CLICKED, 1) class RibbonGalleryEvent(wx.PyCommandEvent): """ Handles events related to :class:`RibbonGallery`. """ def __init__(self, command_type=None, win_id=0, gallery=None, item=None): """
import wx import wx.html import PyTensorNetworks EVT_NEW_HAMILTONIAN = wx.PyEventBinder( wx.NewEventType(), 1) # the 1 is number of expected IDs for the __call__ interface class wxHamiltonianPanel(wx.Panel): def __init__(self, parent): super().__init__(parent) sizer = wx.BoxSizer(wx.VERTICAL) Hexpression0 = wx.Image(name='HeisenbergHamiltonian0x.png', type=wx.BITMAP_TYPE_PNG) HexpressionSBM0 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap(Hexpression0)) sizer.Add(HexpressionSBM0, border=5, flag=wx.ALL) Hexpression1 = wx.Image(name='HeisenbergHamiltonian1x.png', type=wx.BITMAP_TYPE_PNG) HexpressionSBM1 = wx.StaticBitmap(self, wx.ID_ANY, wx.Bitmap(Hexpression1)) sizer.Add(HexpressionSBM1, border=5, flag=wx.ALL) fgsizer = wx.FlexGridSizer(2, 5, 5) self.lattice = wx.SpinCtrl(self, min=2, max=10000, initial=9) latticet = wx.StaticText(self, label='#Lattice sites L: ') fgsizer.Add(latticet, border=5, flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL) fgsizer.Add(self.lattice)
import wx class TwoButtonEvent(wx.PyCommandEvent): def __init__(self, evtType, id): wx.PyCommandEvent.__init__(self, evtType, id) self.clickCount = 0 def GetClickCount(self): return self.clickCount def SetClickCount(self, count): self.clickCount = count myEVT_TWO_BUTTON = wx.NewEventType() EVT_TWO_BUTTON = wx.PyEventBinder(myEVT_TWO_BUTTON, 1) class TwoButtonPanel(wx.Panel): def __init__(self, parent, id=-1, leftText="Left", rightText="Right"): wx.Panel.__init__(self, parent, id) self.leftButton = wx.Button(self, label=leftText) self.rightButton = wx.Button(self, label=rightText, pos=(100, 0)) self.leftClick = False self.rightClick = False self.clickCount = 0 self.leftButton.Bind(wx.EVT_LEFT_DOWN, self.OnLeftClick) self.rightButton.Bind(wx.EVT_LEFT_DOWN, self.OnRightClick) def OnLeftClick(self, event):
# # SPDX-License-Identifier: BSD-3-Clause import codecs import serial import threading import wx import wxSerialConfigDialog # ---------------------------------------------------------------------- # Create an own event type, so that GUI updates can be delegated # this is required as on some platforms only the main thread can # access the GUI without crashing. wxMutexGuiEnter/wxMutexGuiLeave # could be used too, but an event is more elegant. SERIALRX = wx.NewEventType() # bind to serial data receive events EVT_SERIALRX = wx.PyEventBinder(SERIALRX, 0) class SerialRxEvent(wx.PyCommandEvent): eventType = SERIALRX def __init__(self, windowID, data): wx.PyCommandEvent.__init__(self, self.eventType, windowID) self.data = data def Clone(self): self.__class__(self.GetId(), self.data)
Event Name Description ====================================== ====================================== ``EVT_RIBBONTOOLBAR_CLICKED`` Triggered when the normal (non-dropdown) region of a tool on the tool bar is clicked. ``EVT_RIBBONTOOLBAR_DROPDOWN_CLICKED`` Triggered when the dropdown region of a tool on the tool bar is clicked. LRibbonToolBarEvent.PopupMenu should be called by the event handler if it wants to display a popup menu (which is what most dropdown tools should be doing). ====================================== ====================================== """ import wx from .control import RibbonControl from .panel import RibbonPanel from .art import * wxEVT_COMMAND_RIBBONTOOL_CLICKED = wx.NewEventType() wxEVT_COMMAND_RIBBONTOOL_DROPDOWN_CLICKED = wx.NewEventType() EVT_RIBBONTOOLBAR_CLICKED = wx.PyEventBinder(wxEVT_COMMAND_RIBBONTOOL_CLICKED, 1) EVT_RIBBONTOOLBAR_DROPDOWN_CLICKED = wx.PyEventBinder( wxEVT_COMMAND_RIBBONTOOL_DROPDOWN_CLICKED, 1) def GetSizeInOrientation(size, orientation): if orientation == wx.HORIZONTAL: return size.GetWidth() if orientation == wx.VERTICAL: return size.GetHeight()
OPB_STYLE_DEFAULT = 0 # Default Black text styling OPB_STYLE_INFO = 1 # Default Blue text styling OPB_STYLE_WARN = 2 # Default Red text styling OPB_STYLE_ERROR = 3 # Default Red/Hotspot text styling OPB_STYLE_MAX = 3 # Highest style byte used by outputbuffer # All Styles OPB_ALL_STYLES = (wx.stc.STC_STYLE_DEFAULT, wx.stc.STC_STYLE_CONTROLCHAR, OPB_STYLE_DEFAULT, OPB_STYLE_ERROR, OPB_STYLE_INFO, OPB_STYLE_WARN) #--------------------------------------------------------------------------# # Event for notifying that the proces has started running # GetValue will return the command line string that started the process edEVT_PROCESS_START = wx.NewEventType() EVT_PROCESS_START = wx.PyEventBinder(edEVT_PROCESS_START, 1) # Event for notifying that a task is starting to run edEVT_TASK_START = wx.NewEventType() EVT_TASK_START = wx.PyEventBinder(edEVT_TASK_START, 1) # Event for passing output data to buffer # GetValue returns the output text retrieved from the process edEVT_UPDATE_TEXT = wx.NewEventType() EVT_UPDATE_TEXT = wx.PyEventBinder(edEVT_UPDATE_TEXT, 1) # Event for notifying that the the process has finished and no more update # events will be sent. GetValue will return the processes exit code edEVT_PROCESS_EXIT = wx.NewEventType() EVT_PROCESS_EXIT = wx.PyEventBinder(edEVT_PROCESS_EXIT, 1)