def on_btn_demag_gui(self, event): """ Open Demag GUI """ if not self.check_for_meas_file(): return if not self.check_for_uncombined_files(): return outstring = "demag_gui.py -WD %s" % self.WD print("-I- running python script:\n %s" % (outstring)) # disable and hide Pmag GUI mainframe self.Disable() self.Hide() # show busyinfo wait = wx.BusyInfo('Compiling required data, please wait...') wx.SafeYield() # create custom Demag GUI closing event and bind it DemagGuiExitEvent, EVT_DEMAG_GUI_EXIT = newevent.NewCommandEvent() self.Bind(EVT_DEMAG_GUI_EXIT, self.on_analysis_gui_exit) # make and show the Demag GUI frame demag_gui_frame = demag_gui.Demag_GUI(self.WD, self, write_to_log_file=False, data_model=3, evt_quit=DemagGuiExitEvent) demag_gui_frame.Centre() demag_gui_frame.Show() del wait
def on_run_demag_gui(self, event): outstring = "demag_gui.py -WD %s" % self.WD print("-I- running python script:\n %s" % (outstring)) if self.data_model_num == 2: demag_gui.start(self.WD, standalone_app=False, parent=self, DM=self.data_model_num) else: # disable and hide Pmag GUI mainframe self.Disable() self.Hide() # show busyinfo wait = wx.BusyInfo('Compiling required data, please wait...') wx.Yield() # create custom Demag GUI closing event and bind it DemagGuiExitEvent, EVT_DEMAG_GUI_EXIT = newevent.NewCommandEvent() self.Bind(EVT_DEMAG_GUI_EXIT, self.on_analysis_gui_exit) # make and show the Demag GUI frame demag_gui_frame = demag_gui.Demag_GUI( self.WD, self, write_to_log_file=False, data_model=self.data_model_num, evt_quit=DemagGuiExitEvent) demag_gui_frame.Centre() demag_gui_frame.Show() del wait
def on_btn_thellier_gui(self, event): """ Open Thellier GUI """ if not self.check_for_meas_file(): return if not self.check_for_uncombined_files(): return outstring = "thellier_gui.py -WD %s" % self.WD print("-I- running python script:\n %s" % (outstring)) # disable and hide Pmag GUI mainframe self.Disable() self.Hide() # show busyinfo wait = wx.BusyInfo('Compiling required data, please wait...') wx.SafeYield() # create custom Thellier GUI closing event and bind it ThellierGuiExitEvent, EVT_THELLIER_GUI_EXIT = newevent.NewCommandEvent( ) self.Bind(EVT_THELLIER_GUI_EXIT, self.on_analysis_gui_exit) # make and show the Thellier GUI frame thellier_gui_frame = thellier_gui.Arai_GUI( self.WD, self, standalone=False, DM=3, evt_quit=ThellierGuiExitEvent) if not thellier_gui_frame: print("Thellier GUI failed to start aborting") del wait return thellier_gui_frame.Centre() thellier_gui_frame.Show() del wait
def on_run_thellier_gui(self, event): outstring = "thellier_gui.py -WD %s"%self.WD print("-I- running python script:\n %s"%(outstring)) if self.data_model_num == 2.5: thellier_gui.main(self.WD, standalone_app=False, parent=self, DM=self.data_model_num) else: # disable and hide Pmag GUI mainframe self.Disable() self.Hide() # show busyinfo wait = wx.BusyInfo('Compiling required data, please wait...') wx.Yield() # create custom Thellier GUI closing event and bind it ThellierGuiExitEvent, EVT_THELLIER_GUI_EXIT = newevent.NewCommandEvent() self.Bind(EVT_THELLIER_GUI_EXIT, self.on_analysis_gui_exit) # make and show the Thellier GUI frame thellier_gui_frame = thellier_gui.Arai_GUI(self.WD, self, standalone=False, DM=self.data_model_num, evt_quit=ThellierGuiExitEvent) if not thellier_gui_frame: print("Thellier GUI failed to start aborting"); del wait; return thellier_gui_frame.Centre() thellier_gui_frame.Show() del wait
# ---------------------------------------------------------------------------- # Imports # ---------------------------------------------------------------------------- import wx import wx.lib.newevent as newevent # ---------------------------------------------------------------------------- # Events related to the Main Frame # ---------------------------------------------------------------------------- # Notebook: ask to add an empty page # No expected parameter NotebookNewPageEvent, spEVT_NOTEBOOK_NEW_PAGE = newevent.NewEvent() NotebookNewPageCommandEvent, spEVT_NOTEBOOK_NEW_PAGE_COMMAND = newevent.NewCommandEvent( ) # Notebook: ask to close a page # No parameter is expected (the currently selected page is closed) NotebookClosePageEvent, spEVT_NOTEBOOK_CLOSE_PAGE = newevent.NewEvent() NotebookClosePageCommandEvent, spEVT_NOTEBOOK_CLOSE_PAGE_COMMAND = newevent.NewCommandEvent( ) # Settings SettingsEvent, spEVT_SETTINGS = newevent.NewEvent() SettingsCommandEvent, spEVT_SETTINGS_COMMAND = newevent.NewCommandEvent() # One file is removed/added. # Expected parameters are: # - "filename" String # - "status" True/False
#!/usr/bin/env python """ This demo attempts to override the C++ MainLoop and implement it in Python. """ import time import wx import wx.lib.newevent as ne ##import os; raw_input('PID: %d\nPress enter...' % os.getpid()) GooEvent, EVT_GOO = ne.NewCommandEvent() #--------------------------------------------------------------------------- class MyFrame(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title, size=(300, 200)) self.Bind(wx.EVT_SIZE, self.OnSize) self.Bind(wx.EVT_MOVE, self.OnMove) self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) self.Bind(wx.EVT_IDLE, self.OnIdle) self.Bind(wx.EVT_BUTTON, self.OnButton) self.Bind(EVT_GOO, self.OnGoo, id=123) self.count = 0 panel = wx.Panel(self)
import wx from wx.lib import newevent from typing import Tuple, List, Optional import PyMCTranslate from amulet_map_editor.api.image import COLOUR_PICKER ( ItemNamespaceChangeEvent, EVT_ITEM_NAMESPACE_CHANGE, ) = newevent.NewCommandEvent() # the namespace entry changed ( ItemNameChangeEvent, EVT_ITEM_NAME_CHANGE, ) = newevent.NewCommandEvent() # the name entry changed ( ItemChangeEvent, EVT_ITEM_CHANGE, ) = (newevent.NewCommandEvent() ) # the name or namespace changed. Generated after EVT_ITEM_NAME_CHANGE ( PickEvent, EVT_PICK, ) = newevent.NewCommandEvent() # The pick button was pressed class BaseSelect(wx.Panel): TypeName = "?" def __init__(
from typing import Tuple, Dict, Optional, List, Union import weakref import PyMCTranslate import amulet_nbt from amulet_nbt import SNBTType from amulet.api.block import PropertyDataTypes, PropertyType WildcardSNBTType = Union[SNBTType, str] from amulet_map_editor.api.image import ADD_ICON, SUBTRACT_ICON ( PropertiesChangeEvent, EVT_PROPERTIES_CHANGE, ) = newevent.NewCommandEvent() # the properties changed class PropertySelect(wx.Panel): def __init__( self, parent: wx.Window, translation_manager: PyMCTranslate.TranslationManager, platform: str, version_number: Tuple[int, int, int], force_blockstate: bool, namespace: str, block_name: str, properties: Dict[str, SNBTType] = None, wildcard_mode=False, ):
"""Custom top-level events. Only events that do not clearly belong to a single module should go here. Otherwise, the event should go in the associated module. """ import wx from wx.lib import newevent #SetSourceEvent, EVT_SET_SOURCE = newevent.NewCommandEvent() #wxEVT_SET_SOURCE = wx.NewEventType() #EVT_SET_SOURCE = wx.PyEventBinder(wxEVT_SET_SOURCE, 1) #class SetSourceEvent(wx.PyCommandEvent): # def __init__(self, sourceName, id=wx.ID_ANY): # wx.PyCommandEvent.__init__(self, id=id, # eventType=wxEVT_SET_SOURCE) # self.sourceName = sourceName UpdateStatusEvent, EVT_UPDATE_STATUS = newevent.NewCommandEvent() FullScreenEvent, EVT_FULLSCREEN = newevent.NewCommandEvent()
import wx import time import threading import wx.lib.newevent as NE MooEvent, EVT_MOO = NE.NewEvent() GooEvent, EVT_GOO = NE.NewCommandEvent() DELAY = 0.7 def evt_thr(win): time.sleep(DELAY) wx.PostEvent(win, MooEvent(moo=1)) def cmd_thr(win, id): time.sleep(DELAY) wx.PostEvent(win, GooEvent(id, goo=id)) ID_CMD1 = wx.NewId() ID_CMD2 = wx.NewId() class Frame(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, -1, "MOO") sizer = wx.BoxSizer(wx.VERTICAL) self.Bind(EVT_MOO, self.on_moo)
""" self.postInit() self.SetReturnCode(wx.ID_APPLY) def scaleSize(self, size): """Helper method to scale a size using the logical DPI @param size: The size (x,y) as a tuple or a single numerical type to scale @returns: The scaled size, returned as the same type""" if isinstance(size, tuple): return (self.scaleFactor * size[0], self.scaleFactor * size[1]) return self.scaleFactor * size # An event and event binder that will notify the containers that they should # redo the layout in whatever way makes sense for their particular content. _RWLayoutNeededEvent, EVT_RW_LAYOUT_NEEDED = newevent.NewCommandEvent() class SettingsPanel(wx.Panel): """A settings panel, to be used in a multi category settings dialog. A settings panel consists of one or more settings controls. Action may be taken in response to the parent dialog's OK or Cancel buttons. To use this panel: * Set L{title} to the title of the category. * Override L{makeSettings} to populate a given sizer with the settings controls. * Optionally, extend L{onPanelActivated} to perform actions after the category has been selected in the list of categories, such as synthesizer or braille display list population. * Optionally, extend L{onPanelDeactivated} to perform actions after the category has been deselected (i.e. another category is selected) in the list of categories. * Optionally, extend one or both of L{onSave} or L{onDiscard} to perform actions in response to the parent dialog's OK or Cancel buttons, respectively. * Optionally, extend one or both of L{isValid} or L{postSave} to perform validation before or steps after saving, respectively.
from amulet_map_editor.api.wx.ui.simple import SimpleChoice, SimpleChoiceAny import wx from wx.lib import newevent import PyMCTranslate from typing import Tuple, Optional, Type, Any from amulet.api.data_types import VersionNumberTuple, PlatformType ( PlatformChangeEvent, EVT_PLATFORM_CHANGE, ) = newevent.NewCommandEvent() # the platform entry changed ( VersionNumberChangeEvent, EVT_VERSION_NUMBER_CHANGE, ) = newevent.NewCommandEvent() # the version number entry changed ( FormatChangeEvent, EVT_FORMAT_CHANGE, ) = (newevent.NewCommandEvent() ) # the format entry changed (is fired even if the entry isn't visible) ( VersionChangeEvent, EVT_VERSION_CHANGE, ) = (newevent.NewCommandEvent() ) # one of the above changed. Fired after EVT_FORMAT_CHANGE class PlatformSelect(wx.Panel): def __init__(self, parent: wx.Window,
from sppas.src.ui.wxgui.dialogs.basedialog import spBaseDialog from sppas.src.ui.wxgui.cutils.imageutils import spBitmap from sppas.src.ui.wxgui.cutils.textutils import TextValidator from sppas.src.ui.wxgui.sp_icons import TIER_SEARCH from sppas.src.ui.wxgui.sp_icons import BROOM_ICON from sppas.src.ui.wxgui.sp_icons import BACKWARD_ICON from sppas.src.ui.wxgui.sp_icons import FORWARD_ICON from sppas.src.ui.wxgui.sp_icons import CLOSE_ICON # ---------------------------------------------------------------------------- DEFAULT_LABEL = 'label1, label2, etc' SearchedEvent, spEVT_SEARCHED = newevent.NewEvent() SearchedCommandEvent, spEVT_SEARCHED_COMMAND = newevent.NewCommandEvent() # ---------------------------------------------------------------------------- class SearchDialog(spBaseDialog): """ :author: Brigitte Bigi :contact: [email protected] :license: GPL, v3 :summary: This class is used to display a Search dialog. Open a frame to search patterns in a transcription. """ def __init__(self, parent, preferences, trs):
import wx.lib.newevent as NE import wx.grid import threading from configeditorgui import ConfigEditorPanel from processor import Processor from postgresdb import Database from bagfilereader import BAGFileReader from raadpleeggui import BAGRaadpleeg from loggui import LogScherm, AsyncLogScherm from bagconfig import * from log import Log # Define local events # http://wxpython.org/Phoenix/docs/html/lib.newevent.html LocalEvent, EVT_LOCAL = NE.NewCommandEvent() EVT_ID_MENU_ENABLE = wx.NewId() EVT_ID_MENU_DISABLE = wx.NewId() # Generic Local worker thread that dis/enables main menu class WorkerThread(threading.Thread): def __init__(self, app, worker): threading.Thread.__init__(self) self.app = app self.worker = worker self.app.asyncLogScherm.start() Log.log.set_output(self.app.asyncLogScherm) def run(self): try:
import wx from wx.lib import newevent from typing import Tuple, List, Optional import PyMCTranslate from amulet_map_editor.api.image import COLOUR_PICKER ( ItemNamespaceChangeEvent, EVT_ITEM_NAMESPACE_CHANGE, ) = newevent.NewCommandEvent() # the namespace entry changed ( ItemNameChangeEvent, EVT_ITEM_NAME_CHANGE, ) = newevent.NewCommandEvent() # the name entry changed ( ItemChangeEvent, EVT_ITEM_CHANGE, ) = ( newevent.NewCommandEvent() ) # the name or namespace changed. Generated after EVT_ITEM_NAME_CHANGE (PickEvent, EVT_PICK,) = newevent.NewCommandEvent() # The pick button was pressed class BaseSelect(wx.Panel): TypeName = "?" def __init__( self, parent: wx.Window,