示例#1
0
class LabeledControlHelper(object):
    """ Represents a Labeled Control. Provides a class to create and hold on to the objects and automatically associate
	the two controls together.
	Relies on guiHelper.associateElements(), any limitations in guiHelper.associateElements() also apply here.
	"""

    # When the control is enabled / disabled this event is raised.
    # A handler is automatically added to the control to ensure the label is also enabled/disabled.
    EnableChanged, EVT_ENABLE_CHANGED = newevent.NewEvent()

    def __init__(self, parent: wx.Window, labelText: str,
                 wxCtrlClass: wx.Control, **kwargs):
        """ @param parent: An instance of the parent wx window. EG wx.Dialog
			@param labelText: The text to associate with a wx control.
			@param wxCtrlClass: The class to associate with the label, eg: wx.TextCtrl
			@param kwargs: The keyword arguments used to instantiate the wxCtrlClass
		"""
        object.__init__(self)

        class LabelEnableChangedListener(wx.StaticText):
            isDestroyed = False
            isListening = False

            def _onDestroy(self, evt: wx.WindowDestroyEvent):
                self.isDestroyed = True

            def listenForEnableChanged(self, _ctrl: wx.Window):
                self.Bind(wx.EVT_WINDOW_DESTROY, self._onDestroy)
                _ctrl.Bind(LabeledControlHelper.EVT_ENABLE_CHANGED,
                           self._onEnableChanged)
                self.isListening = True

            def _onEnableChanged(self, evt: wx.Event):
                if self.isListening and not self.isDestroyed:
                    self.Enable(evt.isEnabled)

        class WxCtrlWithEnableEvnt(wxCtrlClass):
            def Enable(self, enable=True):
                evt = LabeledControlHelper.EnableChanged(isEnabled=enable)
                wx.PostEvent(self, evt)
                super().Enable(enable)

            def Disable(self):
                evt = LabeledControlHelper.EnableChanged(isEnabled=False)
                wx.PostEvent(self, evt)
                super().Disable()

        self._label = LabelEnableChangedListener(parent, label=labelText)
        self._ctrl = WxCtrlWithEnableEvnt(parent, **kwargs)
        self._label.listenForEnableChanged(self._ctrl)
        self._sizer = associateElements(self._label, self._ctrl)

    @property
    def control(self):
        return self._ctrl

    @property
    def sizer(self):
        return self._sizer
示例#2
0
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)
            else:          button.SetValue(False)


    def __onButton(self, ev):
        """Called when a button is pushed. Updates the selection,
        and emits a :data:`BitmapRadioEvent`.
        """

        idx  = self.__buttons.index(ev.GetEventObject())
        data = self.__clientData[idx]

        self.SetSelection(idx)

        wx.PostEvent(self, BitmapRadioEvent(index=idx, clientData=data))


_BitampRadioEvent, _EVT_BITMAP_RADIO_EVENT = wxevent.NewEvent()


EVT_BITMAP_RADIO_EVENT = _EVT_BITMAP_RADIO_EVENT
"""Identifier for the :data:`BitmapRadioEvent`. """


BitmapRadioEvent = _BitampRadioEvent
"""Event emitted when the user changes the radio selection. Contains
the following attributes:

  - ``index``:      The index of the new selection.
  - ``clientData``: Client data associated with the new selection.
"""
示例#4
0
#   that's where it belongs.
#
# Tags:     phoenix-port

import wx
import wx.lib.newevent as newevent

from . import pycolourbox
from . import pypalette
from . import pycolourslider
import colorsys
from . import intl

from .intl import _  # _

ColourChangedEventBase, EVT_COLOUR_CHANGED = newevent.NewEvent()


class ColourChangedEvent(ColourChangedEventBase):
    """Adds GetColour()/GetValue() for compatibility with ColourPickerCtrl and colourselect"""
    def __init__(self, newColour):
        super().__init__(newColour=newColour)

    def GetColour(self):
        return self.newColour

    def GetValue(self):
        return self.newColour


class PyColourChooser(wx.Panel):
        spinMin   = float(self.__spinMin)
        realMin   = float(self.__realMin)
        realRange = float(self.__realRange)
        spinRange = float(self.__spinRange)

        value     = spinMin + (value - realMin) * (spinRange / realRange)

        # Don't allow the value to flow over
        # the real wx.SpinButton range.
        if   value < self.__realSpinMin: value = self.__realSpinMin
        elif value > self.__realSpinMax: value = self.__realSpinMax

        return int(round(value))


_FloatSpinEvent,      _EVT_FLOATSPIN       = wxevent.NewEvent()
_FloatSpinEnterEvent, _EVT_FLOATSPIN_ENTER = wxevent.NewEvent()


EVT_FLOATSPIN = _EVT_FLOATSPIN
"""Identifier for the :data:`FloatSpinEvent` event. """


FloatSpinEvent = _FloatSpinEvent
"""Event emitted when the floating point value is changed by the user. A
``FloatSpinEvent`` has the following attributes:

  - ``value``: The new value.
"""

示例#6
0
    PostDrawEvent,
    EVT_POST_DRAW,
)

from amulet_map_editor.api.wx.util.button_input import (
    InputPressEvent,
    InputHeldEvent,
    InputReleaseEvent,
    EVT_INPUT_PRESS,
    EVT_INPUT_HELD,
    EVT_INPUT_RELEASE,
)

from .selection import SelectionChangeEvent, EVT_SELECTION_CHANGE

DimensionChangeEvent, EVT_DIMENSION_CHANGE = newevent.NewEvent()

# the active tool changed
ToolChangeEvent, EVT_TOOL_CHANGE = newevent.NewEvent()
PasteEvent, EVT_PASTE = newevent.NewEvent()

UndoEvent, EVT_UNDO = newevent.NewEvent()
RedoEvent, EVT_REDO = newevent.NewEvent()
CreateUndoEvent, EVT_CREATE_UNDO = newevent.NewEvent()
SaveEvent, EVT_SAVE = newevent.NewEvent()
EditCloseEvent, EVT_EDIT_CLOSE = newevent.NewEvent()

# The button to select the box was clicked. (Usually left mouse) Note based on the state the box may be unchanged.
# TODO: remove this
BoxClickEvent, EVT_BOX_CLICK = newevent.NewEvent()
示例#7
0
                                 alongside this item.
        """
        self.label = label
        self.data = data
        self.labelWidget = labelWidget
        self.container = container
        self.tooltip = tooltip
        self.defaultFGColour = defaultFGColour
        self.selectedFGColour = selectedFGColour
        self.defaultBGColour = defaultBGColour
        self.selectedBGColour = selectedBGColour
        self.extraWidget = extraWidget
        self.hidden = False


_ListSelectEvent, _EVT_ELB_SELECT_EVENT = wxevent.NewEvent()
_ListAddEvent, _EVT_ELB_ADD_EVENT = wxevent.NewEvent()
_ListRemoveEvent, _EVT_ELB_REMOVE_EVENT = wxevent.NewEvent()
_ListMoveEvent, _EVT_ELB_MOVE_EVENT = wxevent.NewEvent()
_ListEditEvent, _EVT_ELB_EDIT_EVENT = wxevent.NewEvent()
_ListDblClickEvent, _EVT_ELB_DBLCLICK_EVENT = wxevent.NewEvent()

EVT_ELB_SELECT_EVENT = _EVT_ELB_SELECT_EVENT
"""Identifier for the :data:`ListSelectEvent` event."""

EVT_ELB_ADD_EVENT = _EVT_ELB_ADD_EVENT
"""Identifier for the :data:`ListAddEvent` event."""

EVT_ELB_REMOVE_EVENT = _EVT_ELB_REMOVE_EVENT
"""Identifier for the :data:`ListRemoveEvent` event."""
controls.
"""

RSSP_EDIT_LIMITS = 8
"""If set, and :data:`RSSP_SHOW_LIMITS` is also set, the minimum/maximum
range values are shown alongside the range controls on buttons. When
the presses a button, a dialog is displayed allowing them to change the
range limits.
"""

RSSP_NO_LIMIT = 16
"""If set, the user is able to enter values into the spin controls which
are outside of the current minimum/maximum.
"""

_RangeEvent, _EVT_RANGE = wxevent.NewEvent()
_LowRangeEvent, _EVT_LOW_RANGE = wxevent.NewEvent()
_HighRangeEvent, _EVT_HIGH_RANGE = wxevent.NewEvent()
_RangeLimitEvent, _EVT_RANGE_LIMIT = wxevent.NewEvent()

EVT_RANGE = _EVT_RANGE
"""Identifier for the :data:`RangeEvent`."""

EVT_LOW_RANGE = _EVT_LOW_RANGE
"""Identifier for the :data:`LowRangeEvent`."""

EVT_HIGH_RANGE = _EVT_HIGH_RANGE
"""Identifier for the :data:`HighRangeEvent`."""

EVT_RANGE_LIMIT = _EVT_RANGE_LIMIT
"""Identifier for the :data:`RangeLimitEvent`."""
示例#9
0
import inspect

from printerinstances import PrinterInstances
from printerdlg import PrinterDlg
from images import Images
from settings import Settings
from toolbox import ToolBox
import wx
from wx.lib import newevent

BTNDIM = (48, 48)

cmdFolder = os.path.realpath(
    os.path.abspath(os.path.split(inspect.getfile(inspect.currentframe()))[0]))

(RegisterEvent, EVT_REGISTER) = newevent.NewEvent()  # @UndefinedVariable


class MyFrame(wx.Frame):
    def __init__(self):
        self.destroyed = False
        self.t = 0
        self.seq = 1

        self.images = Images(os.path.join(cmdFolder, "images"))
        self.toolicons = Images(os.path.join(cmdFolder, "images", "tools"))

        self.printerList = []
        self.settings = Settings(cmdFolder)

        wx.Frame.__init__(self, None, -1, "Octoprint Monitor", size=(300, 300))
示例#10
0
文件: Histo.py 项目: txthuong/EULER
# -*- coding: utf-8 -*-
# Auteur   JM Seillon
#Date      27/04/2012
#
#
#26-07-2012        JM Seillon          1.9.0                 add ClearListData()
#11-03-2013		   Eric BARRE		   1.9.3				  HiloStarter: fix the GNSS feature to support the display of the ID/SNR before fix

#
import wx
from wx.lib import newevent
import  time
import  thread


(UpdateBarEvent, EVT_UPDATE_BARGRAPH) = newevent.NewEvent()

listGNSS = []

# Création d'un nouveau cadre, dérivé du wxPython 'Frame'.

class Histo(wx.Frame):
	def __init__(self, parent, log):
		''' constructor '''
		wx.Frame.__init__(self, parent, -1, "Hilo Starter Graph",style=wx.CAPTION | wx.MINIMIZE_BOX | wx.RESIZE_BORDER)
		self.log = log

		panel = wx.Panel(self, -1)
		panel.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD))

		panel.Fit()
示例#11
0
 def __init__(self):
     self.count = settings.CONFIG.getint('DEFAULT', 'Repeat Count')
     self.infinite = settings.CONFIG.getboolean('DEFAULT',
                                                'Infinite Playback')
     self.count_was_updated = False
     self.ThreadEndEvent, self.EVT_THREAD_END = NE.NewEvent()
示例#12
0
from wx.lib import newevent

CameraMoveEvent, EVT_CAMERA_MOVE = newevent.NewEvent()
CameraRotateEvent, EVT_CAMERA_ROTATE = newevent.NewEvent()
DimensionChangeEvent, EVT_DIMENSION_CHANGE = newevent.NewEvent()

# the active tool changed
ToolChangeEvent, EVT_TOOL_CHANGE = newevent.NewEvent()
PasteEvent, EVT_PASTE = newevent.NewEvent()

UndoEvent, EVT_UNDO = newevent.NewEvent()
RedoEvent, EVT_REDO = newevent.NewEvent()
CreateUndoEvent, EVT_CREATE_UNDO = newevent.NewEvent()
SaveEvent, EVT_SAVE = newevent.NewEvent()
EditCloseEvent, EVT_EDIT_CLOSE = newevent.NewEvent()
EditEscapeEvent, EVT_EDIT_ESCAPE = newevent.NewEvent()  # the escape key was pressed

# the block highlighted by the cursor changed position.
SelectionPointChangeEvent, EVT_SELECTION_POINT_CHANGE = newevent.NewEvent()

# events fired when the active selection box changes.  TODO: reimplement these
(
    BoxChangeEvent,
    EVT_BOX_CHANGE,
) = newevent.NewEvent()  # one or more of the box coordinates have changed

(
    BoxDisableInputsEvent,
    EVT_BOX_DISABLE_INPUTS,
) = newevent.NewEvent()  # the box starts being edited
(
示例#13
0
'''
Created on 22-08-2012

@author: Piotr Iwaniuk
'''
from psychopy.app.builder.amp_launcher.obci_client.obci_connection import OBCIConnection
import os.path
from wx.lib import newevent

class AmpListRetrieverException(Exception):
    pass

RetrieverStartedEvent, EVT_RETRIEVER_STARTED = newevent.NewEvent()
RetrieverFinishedEvent, EVT_RETRIEVER_FINISHED = newevent.NewEvent()

class AmplifierInfo(object):
    """Contains all interesting data about an amplifier discovered by AmpListRetriever
    """
    def __init__(self, amplifier_list=[]):
        # TODO copy object for correctness?
        self.amplifier_list = amplifier_list
        self.amplifier_config = [{} for _ in self.amplifier_list]
    
    def get_entry(self, entry_index):
        return AmplifierInfoEntry(self.amplifier_list[entry_index])
    
    def get_summary(self):
        for entry in self.amplifier_list:
            yield [
                entry[0],
                os.path.split(entry[1]["experiment_info"]["launch_file_path"])[1],
示例#14
0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
# 02111-1307 USA
#
# CREDIT TO "David P. Janes" AND "BlogMatrix" WOULD BE APPRECIATED
# Donations gratefully accepted at "http://jaeger.blogmatrix.com/donate/".
#

import sys

import wx
#from wxPython.wx import *
from wx.lib import newevent

DispatchEvent, EVT_DISPATCH = newevent.NewEvent()


class GenericDispatchMixin:
    def __init__(self):
        EVT_DISPATCH(self, self.OnDispatchEvent)

    def OnDispatchEvent(self, event):
        event.method(*event.arguments)

    def ThreadSafeDispatch(self, method, *arguments):
        wx.PostEvent(self, DispatchEvent(method=method, arguments=arguments))
示例#15
0
from wx.lib import newevent

CameraMoveEvent, EVT_CAMERA_MOVE = newevent.NewEvent()
CameraRotateEvent, EVT_CAMERA_ROTATE = newevent.NewEvent()
DimensionChangeEvent, EVT_DIMENSION_CHANGE = newevent.NewEvent()

# the active tool changed
ToolChangeEvent, EVT_TOOL_CHANGE = newevent.NewEvent()
PasteEvent, EVT_PASTE = newevent.NewEvent()

UndoEvent, EVT_UNDO = newevent.NewEvent()
RedoEvent, EVT_REDO = newevent.NewEvent()
CreateUndoEvent, EVT_CREATE_UNDO = newevent.NewEvent()
SaveEvent, EVT_SAVE = newevent.NewEvent()
EditCloseEvent, EVT_EDIT_CLOSE = newevent.NewEvent()
EditEscapeEvent, EVT_EDIT_ESCAPE = newevent.NewEvent(
)  # the escape key was pressed

# the block highlighted by the cursor changed position.
SelectionPointChangeEvent, EVT_SELECTION_POINT_CHANGE = newevent.NewEvent()

# events fired when the active selection box changes.  TODO: reimplement these
BoxChangeEvent, EVT_BOX_CHANGE = newevent.NewEvent(
)  # one or more of the box coordinates have changed
BoxEditToggleEvent, EVT_BOX_EDIT_TOGGLE = newevent.NewEvent(
)  # the box has switched between edit and static mode
示例#16
0
import wx
import wx.grid
from retriever import AmpListRetriever
from psychopy.app.builder.amp_launcher.amplifier_panels import ChannelsPanel,\
    ParametersPanel, AmpConfigPanel
from obci.control.common.message import OBCIMessageTool
from obci.control.launcher import launcher_messages
from obci_client import obci_connection
from psychopy.app.builder.amp_launcher import retriever, amp_manager
import os.path
import json
from wx.lib import throbber, newevent
import time
import threading

ExperimentReady, EVT_EXPERIMENT_READY = newevent.NewEvent()


class AmpListPanel(wx.Panel):
    """A panel control with a refreshable list of amplifiers"""
    COLUMN_PROPORTIONS = [1, 2, 2, 1]

    def __init__(self, parent):
        super(AmpListPanel, self).__init__(parent, wx.ID_ANY)
        self.amp_info = None
        self.proportions_sum = reduce(lambda x, y: x + y,
                                      self.COLUMN_PROPORTIONS)
        self.init_controls()
        self.init_sizer()

    def init_controls(self):
示例#17
0
import wx
from wx.lib import newevent
from board import Board
from engine import Engine

evt_speed_changed, EVT_SPEED = newevent.NewEvent()


class WxRenderer(wx.App):
    def __init__(self):
        self._timer = None
        self._board = None
        self._engine = None
        self._gui = None
        self._speed = 500
        super(WxRenderer, self).__init__(False)

    def OnInit(self):
        self._board = Board(30, 30)
        self._engine = Engine(self._board)
        self._gui = MainFrame(self._board)
        self._gui.Show()

        self._timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self._iterate, self._timer)
        self.Bind(EVT_SPEED, self._update_speed)

        self._init_game_board()

        self._timer.Start(self._speed)
示例#18
0
import time
import struct
import sys
import os
import re
import threading
from functools import partial

import wx
import wx.lib.newevent as NE

from spidriver import SPIDriver

PingEvent, EVT_PING = NE.NewEvent()

def ping_thr(win):
    while True:
        wx.PostEvent(win, PingEvent())
        time.sleep(1)

class HexTextCtrl(wx.TextCtrl):
    def __init__(self, *args, **kwargs):
        super(HexTextCtrl, self).__init__(*args, **kwargs)
        self.Bind(wx.EVT_TEXT, self.on_text)
    def on_text(self, event):
        event.Skip()
        selection = self.GetSelection()
        value = self.GetValue().upper()
        hex = "0123456789ABCDEF"
        value = "".join([c for c in value if c in hex])
        self.ChangeValue(value)
示例#19
0
You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
'''

from taskcoachlib import widgets, operating_system
from taskcoachlib.domain import date
from taskcoachlib.gui import artprovider
from taskcoachlib.i18n import _
from taskcoachlib.thirdparty import combotreebox
import datetime
from wx.lib import newevent
import wx
import wx.combo

DateTimeEntryEvent, EVT_DATETIMEENTRY = newevent.NewEvent()


class DateTimeEntry(widgets.DateTimeCtrl):
    defaultDateTime = date.DateTime()

    def __init__(self,
                 parent,
                 settings,
                 initialDateTime=defaultDateTime,
                 readonly=False,
                 noneAllowed=True,
                 showSeconds=False,
                 suggestedDateTime=None,
                 showRelative=False,
                 adjustEndOfDay=False,
示例#20
0
        # with the option list underneath.
        posx, posy = self.__textCtrl.GetScreenPosition().Get()

        self.__popup = popup

        popup.SetSize((-1, -1))
        popup.SetPosition((posx, posy))
        popup.Show()


ATC_CASE_SENSITIVE = 1
"""Syle flag for use with the :class:`AutoTextCtrl` class. If set, the
auto-completion pattern matching will be case sensitive.
"""

_AutoTextCtrlEnterEvent, _EVT_ATC_TEXT_ENTER = wxevent.NewEvent()

EVT_ATC_TEXT_ENTER = _EVT_ATC_TEXT_ENTER
"""Identifier for the :data:`AutoTextCtrlEnterEvent`, which is generated
when the user presses enter in an :class:`AutoTextCtrl`.
"""

AutoTextCtrlEnterEvent = _AutoTextCtrlEnterEvent
"""Event generated when the user presses enter in an :class:`AutoTextCtrl`.
Contains a single attribute, ``text``, which contains the text in the
``AutoTextCtrl``.
"""


class AutoCompletePopup(wx.Frame):
    """The ``AutoCompletePopup`` class is used by the :class:`AutoTextCtrl`
示例#21
0
WG_SELECTABLE_CELLS = 1
"""If this style is enabled, individual cells can be selected. """

WG_SELECTABLE_ROWS = 2
"""If this style is enabled, whole rows can be selected. """

WG_SELECTABLE_COLUMNS = 4
"""If this style is enabled, whole columns can be selected. """

WG_KEY_NAVIGATION = 8
"""If this style is enabled along with one of the ``*_SELECTABLE_*`` styles,
the user may use the keyboard to navigate between cells, rows, or columns.
"""

_WidgetGridSelectEvent, _EVT_WG_SELECT = wxevent.NewEvent()

EVT_WG_SELECT = _EVT_WG_SELECT
"""Identifier for the :data:`WidgetGridSelectEvent`. """

WidgetGridSelectEvent = _WidgetGridSelectEvent
"""Event generated when an item in a ``WidgetGrid`` is selected. A
``WidgetGridSelectEvent`` has the following attributes:

 - ``row`` Row index of the selected item. If -1, an entire column
   has been selected.

 - ``col`` Column index of the selected item. If -1, an entire row
   has been selected.
"""
示例#22
0
文件: init.py 项目: szz-dvl/GAL
#!/usr/bin/python

from evdev import InputDevice
import exceptions
import json
import sys
import wx.lib.newevent as NE
import wx
import time
from Xlib.display import Display
import os

UpdateEvent, EVT_UPDT = NE.NewEvent()
EndSessionEvent, EVT_ENDSES = NE.NewEvent()

MASTER_CFG = os.path.dirname(sys.argv[0]) + "/confis.json"


class GamePad():
    def __init__(self, path, keysx, keysd):
        self.path = path
        self.keysx = keysx
        self.keysd = keysd

    def get_device(self):
        return InputDevice(self.path)


class CfgMgr(dict):
    def __init__(self):
示例#23
0

class _Group:
    """The ``_Group`` class is used internally by :class:`WidgetList`
    instances to represent groups of widgets that are in the list.
    """
    def __init__(self, groupName, displayName, gapSizer, parentPanel, colPanel,
                 widgPanel, sizer):
        self.groupName = groupName
        self.displayName = displayName
        self.gapSizer = gapSizer
        self.parentPanel = parentPanel
        self.colPanel = colPanel
        self.widgPanel = widgPanel
        self.sizer = sizer
        self.widgets = {}


_WidgetListChangeEvent, _EVT_WL_CHANGE_EVENT = wxevent.NewEvent()

WidgetListChangeEvent = _WidgetListChangeEvent
"""Event emitted by a :class:`WidgetList` when its contents change. """

EVT_WL_CHANGE_EVENT = _EVT_WL_CHANGE_EVENT
"""Identifier for the :data:`WidgetListChangeEvent`. """

WL_ONE_EXPANDED = 1
""":class:`WidgetList` style flag. When applied, at most one group will
be expanded at any one time.
"""
示例#24
0
    @property
    def point1(self) -> BlockCoordinates:
        return self._point1

    @property
    def point2(self) -> BlockCoordinates:
        return self._point2

    @property
    def points(self) -> Tuple[BlockCoordinates, BlockCoordinates]:
        return self._point1, self._point2


# run when self._editing is set to True or the active selection is removed. Locks external editing
RenderBoxDisableInputsEvent, EVT_RENDER_BOX_DISABLE_INPUTS = newevent.NewEvent(
)

# run when self._editing is set to False and there is an active selection. Allows external editing
RenderBoxEnableInputsEvent, EVT_RENDER_BOX_ENABLE_INPUTS = newevent.NewEvent()

NPArray2x3 = numpy.ndarray
NPVector3 = numpy.ndarray


class BlockSelectionBehaviour(PointerBehaviour):
    """Adds the behaviour for a block based selection."""
    def __init__(self, canvas: "EditCanvas"):
        super().__init__(canvas)
        self._selection: RenderSelectionGroupHighlightable = (
            RenderSelectionGroupHighlightable(
                self.canvas.context_identifier,
示例#25
0
__copyright__ = """Copyright (C) 2011-2015  Brigitte Bigi"""

# ----------------------------------------------------------------------------
# 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:
示例#26
0
from wx.lib import newevent

CameraMoveEvent, EVT_CAMERA_MOVE = newevent.NewEvent()

SelectToolEnabledEvent, EVT_SELECT_TOOL_ENABLED = newevent.NewEvent()
OperationToolEnabledEvent, EVT_OPERATION_TOOL_ENABLED = newevent.NewEvent()
ImportToolEnabledEvent, EVT_IMPORT_TOOL_ENABLED = newevent.NewEvent()
ExportToolEnabledEvent, EVT_EXPORT_TOOL_ENABLED = newevent.NewEvent()

BoxGreenCornerChangeEvent, EVT_BOX_GREEN_CORNER_CHANGE = newevent.NewEvent()
BoxBlueCornerChangeEvent, EVT_BOX_BLUE_CORNER_CHANGE = newevent.NewEvent()

BoxCoordsEnableEvent, EVT_BOX_COORDS_ENABLE = newevent.NewEvent()
示例#27
0
        self.__buttonPanel.Layout()
        self.__buttonPanel.Refresh()

    def __onButton(self, ev):
        """Called when a page button is pushed. Selects the respective page,
        and emits a :data:`PageChangeEvent`.
        """

        button = ev.GetEventObject()
        pageIdx = button.GetId()

        if not button.IsEnabled(): return
        if self.GetSelection() == pageIdx: return

        self.SetSelection(pageIdx)

        wx.PostEvent(self, PageChangeEvent(index=pageIdx))


_PageChangeEvent, _EVT_PAGE_CHANGE = wxevent.NewEvent()

EVT_PAGE_CHANGE = _EVT_PAGE_CHANGE
"""Identifier for the :data:`PageChangeEvent` event. """

PageChangeEvent = _PageChangeEvent
"""Event emitted when the page is changed by the user. A ``PageChangeEvent``
has the following attributes:

  - ``index`` The index of the page that was selected.
"""
示例#28
0
"""Events

This file contains the different events needed for the app to work 
correctly. This events are self-made and integrated with wxPython's
events. 
"""
# WX import
import wx
import wx.lib.newevent as ne

# Serial CONNECTION events
SerialCTrue, EVT_SERIALC = ne.NewEvent()
SerialCError, EVT_SERIALCE = ne.NewEvent()
SerialCDisconnect, EVT_SERIALD = ne.NewEvent()
SERIALC = wx.NewEventType()

# Serial READING events
SerialREvent, EVT_SERIALR = ne.NewEvent()
SerialRError, EVT_SERIALRE = ne.NewEvent()
SerialRMessage, EVT_SERIALRM = ne.NewEvent()
SerialRFrameErr, EVT_SERIALFE = ne.NewEvent()
SERIALR = wx.NewEventType()

# Serial WRITING events
SerialWEvent, EVT_SERIALW = ne.NewEvent()
SerialWErr, EVT_SERIALWE = ne.NewEvent()
SERIALW = wx.NewEventType()

# Device connection MENU events
DeviceDEvent, EVT_DEVDISCONNECT = ne.NewEvent()
DeviceCEvent, EVT_DEVCONNECT = ne.NewEvent()
示例#29
0
        if trueBmp is None:
            return

        if self.GetValue(): wx.ToggleButton.SetBitmapLabel(self, trueBmp)
        else: wx.ToggleButton.SetBitmapLabel(self, falseBmp)

    def __onToggle(self, ev):
        """Called when this button is pressed.

        Flips the button state, and emits a :data:`BitmapToggleEvent`.
        """
        self.__updateBitmap()

        ev = BitmapToggleEvent(value=self.GetValue())
        ev.SetEventObject(self)

        wx.PostEvent(self, ev)


_BitmapToggleEvent, _EVT_BITMAP_TOGGLE = wxevent.NewEvent()

EVT_BITMAP_TOGGLE = _EVT_BITMAP_TOGGLE
"""Identifier for the :data:`BitmapToggleEvent` event."""

BitmapToggleEvent = _BitmapToggleEvent
"""Event emitted when a :class:`BitmapToggleButton` is pushed.

Contains one attribute, ``value``, which contains the current button state
(``True`` or ``False``).
"""
示例#30
0
import wx
from wx.lib import newevent
from serial import SerialException

from dccsniffer import SnifferThread
from locolist import LocoList

(DCCMessageEvent, EVT_DCCMESSAGE) = newevent.NewEvent()
(DCCClosedEvent, EVT_DCCCLOSED) = newevent.NewEvent()


class MyFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None, -1, "My Frame", size=(300, 300))
        self.Bind(wx.EVT_CLOSE, self.onClose)

        self.sniffer = None

        sz = wx.BoxSizer(wx.VERTICAL)
        sz.AddSpacer(20)

        st = wx.StaticText(self, -1, "Sniffer Tester")
        nbFont = wx.Font(16, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL,
                         wx.FONTWEIGHT_BOLD)
        st.SetForegroundColour(wx.Colour(37, 61, 180))
        st.SetFont(nbFont)

        sz.Add(st)

        sz.AddSpacer(20)