Пример #1
0
class ThreadClass(Thread):
    # Custom event for data sharing
    pc_info, EVT_DATA = NewEvent()

    def __init__(self, parent):
        Thread.__init__(self)
        self.parent = parent
        # local thread flag
        self.threadFlag = False

    def setThreadFlag(self, s):
        # Set function to control local thread flag
        self.threadFlag = s

    def run(self):
        # check local thread flag
        while self.threadFlag:
            # do the work under this thread instance
            cpu = sysinfo.getCPU()
            ram = sysinfo.getRAM()
            result = {'cpu': cpu, 'ram': ram}
            # update custom event pointer
            wx.PostEvent(self.parent, self.pc_info(data=result))

    def close(self):
        # Set thread flag for terminating
        self.threadFlag = False
        # Terminate thread instance
        self.join(1)
    def __init__(self,
                 parent,
                 title="Beam Profile",
                 object=None,
                 refresh_period=1.0,
                 size=(300, 300),
                 *args,
                 **kwargs):
        """title: string
        object: has attributes "image","x_ROI_center",...
        """
        wx.Window.__init__(self, parent, size=size, *args, **kwargs)
        self.title = title
        self.object = object
        self.refresh_period = refresh_period

        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_SIZE, self.OnResize)

        # Refresh
        from numpy import nan, uint16
        from numimage import numimage
        self.values = dict([(n, nan) for n in self.attributes])
        self.values["image"] = numimage((0, 0), dtype=uint16, pixelsize=0.080)
        self.old_values = {}

        from threading import Thread
        self.refresh_thread = Thread(target=self.refresh_background,
                                     name=self.name + ".refresh")
        self.refreshing = False

        from wx.lib.newevent import NewEvent
        self.EVT_THREAD = NewEvent()[1]
        self.Bind(self.EVT_THREAD, self.OnUpdate)
        self.thread = Thread(target=self.keep_updated, name=self.name)
        self.thread.start()
Пример #3
0
    .. moduleauthor::  Tobias Eberle  <*****@*****.**>
    .. versionadded:: 0.14
"""


from __future__ import (print_function, division, unicode_literals,
                        absolute_import)

from wx import EvtHandler, PostEvent
from wx.lib.newevent import NewEvent

from inaugurator.pyudev.monitor import MonitorObserver


DeviceEvent, EVT_DEVICE_EVENT = NewEvent()
DeviceAddedEvent, EVT_DEVICE_ADDED = NewEvent()
DeviceRemovedEvent, EVT_DEVICE_REMOVED = NewEvent()
DeviceChangedEvent, EVT_DEVICE_CHANGED = NewEvent()
DeviceMovedEvent, EVT_DEVICE_MOVED = NewEvent()


class WxUDevMonitorObserver(EvtHandler):
    """
    An observer for device events integrating into the :mod:`wx` mainloop.

    This class inherits :class:`~wx.EvtHandler` to turn device events into
    wx events:

    >>> from pyudev import Context, Device
    >>> from pyudev.wx import WxUDevMonitorObserver
Пример #4
0
import json
from multiprocessing import Process
import multiprocessing
import itertools
import ctypes
    
from asyncio.events import get_event_loop
import asyncio
import wx
import warnings
from asyncio.futures import CancelledError
from collections import defaultdict
import platform


TestEvent, EVT_TEST_EVENT = NewEvent()


IS_MAC = platform.system() == "Darwin"

class WxAsyncApp(wx.App):
    def __init__(self, warn_on_cancel_callback=False, loop=None):
        super(WxAsyncApp, self).__init__()
        self.loop = loop or get_event_loop()
        self.BoundObjects = {}
        self.RunningTasks = defaultdict(set)
        self.SetExitOnFrameDelete(True)
        self.exiting = asyncio.Event()
        self.warn_on_cancel_callback = warn_on_cancel_callback
        self.evtloop = wx.GUIEventLoop()
        self.activator = wx.EventLoopActivator(self.evtloop)
Пример #5
0
import math
import copy
import tempfile
import types

import wx
from wx.lib.newevent import NewEvent

from grass.script import core as grass

from core import utils
from core.gcmd import GException, GError, RunCommand
from core.debug import Debug
from core.settings import UserSettings

wxUpdateProgressBar, EVT_UPDATE_PRGBAR = NewEvent()

#
# use g.pnmcomp for creating image composition or
# wxPython functionality
#
USE_GPNMCOMP = True


class Layer(object):
    """!Virtual class which stores information about layers (map layers and
    overlays) of the map composition.
    
    For map layer use MapLayer class.
    For overlays use Overlay class.
    """
About:

ButtonTreeCtrlPanel is distributed under the wxWidgets license.

For all kind of problems, requests, enhancements, bug reports, etc,
please drop me an e-mail.

For updates please visit <http://j.domaindlx.com/elements28/wxpython/>.
"""

import wx
from wx.lib.newevent import NewEvent

#----------------------------------------------------------------------------

(ButtonTreeCtrlPanelEvent, EVT_BUTTONTREECTRLPANEL) = NewEvent()
EVT_CHANGED = EVT_BUTTONTREECTRLPANEL

#----------------------------------------------------------------------------

class ButtonTreeCtrlPanel(wx.Panel):
    def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition,
                 size=wx.DefaultSize, style=wx.WANTS_CHARS):
        wx.Panel.__init__(self, parent, id, pos, size, style)

        self.tree = wx.TreeCtrl(self, style=wx.TR_NO_LINES|wx.TR_HIDE_ROOT)

        il = self.il = wx.ImageList(16, 16)
        self.tree.SetImageList(il)

        for bl in ["checkbox_checked", "checkbox_unchecked", "checkbox_tri",
Пример #7
0
# -*- coding: utf-8 -*-
"""
.. module:: events
   :platform: Unix, Windows
   :synopsis: Custom events definition

.. moduleauthor:: Anton Konyshev <*****@*****.**>

"""

from wx.lib.newevent import NewEvent

newevent = NewEvent()
LoadVideo = newevent[0]
"""Command to load chosen video file.

Receivers:
    Player (wx.Frame): player window.

Kwargs:
    filepath (str): path to the video file.

"""
LOAD_VIDEO = newevent[1]

newevent = NewEvent()
LoadSubtitles = newevent[0]
"""Command to load chosen subtitles file.

Receivers:
    Player (wx.Frame): player window.
Пример #8
0
from threading import Thread
import wx
from wx.lib.newevent import NewEvent
from voicecontrol.run_sarmata import runSarmata

EventVPlay, V_EVT_PLAY = NewEvent()
EventVPause, V_EVT_PAUSE = NewEvent()
EventVStop, V_EVT_STOP = NewEvent()
EventVNext, V_EVT_NEXT = NewEvent()
EventVPrev, V_EVT_PREV = NewEvent()
EventVRandomOff, V_EVT_RND_OFF = NewEvent()
EventVRandomOn, V_EVT_RND_ON = NewEvent()
EventVRepeatOff, V_EVT_RPT_OFF = NewEvent()
EventVRepeatOn, V_EVT_RPT_ON = NewEvent()
EventVVolChange, V_EVT_VOL = NewEvent()
EventVFinish, V_EVT_FINISH = NewEvent()
EventVMessage, V_EVT_MES = NewEvent()

class CommandHandlerThread(Thread):

    def __init__(self, notify_window):
        Thread.__init__(self)
        self.notify_window = notify_window
        self.start()

    def stop(self):
        self._is_running = False

    def recognize(self):
        command, status = runSarmata()
        self.execute(command, status)
Пример #9
0
You should have received a copy of the GNU Lesser General Public
License along with this library.
"""

import math, sys, time, types, string, wx
import threading, logging, struct
import Queue
from ConfigParser import SafeConfigParser

import socket
import json

from wx.lib.newevent import NewEvent

# New Event Declarations
LogEvent, EVT_LOG = NewEvent()
RxStaEvent, EVT_STAT = NewEvent()
ACM_StaEvent, EVT_ACM_STAT = NewEvent()
CMP_StaEvent, EVT_CMP_STAT = NewEvent()
GND_StaEvent, EVT_GND_STAT = NewEvent()
ACM_DatEvent, EVT_ACM_DAT = NewEvent()
CMP_DatEvent, EVT_CMP_DAT = NewEvent()
GND_DatEvent, EVT_GND_DAT = NewEvent()
EXP_DatEvent, EVT_EXP_DAT = NewEvent()

ALPHA_ONLY = 1
DIGIT_ONLY = 2
HEX_ONLY = 3


def _(ori_string):
Пример #10
0
expand = PyEmbeddedImage(
    "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAAZiS0dE"
    "AP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9oCBRUpC/sWEUMAAAA9"
    "SURBVDjLY2AY1uA/MYqYKDWEiVKXMFHqHSZKw4SJ0oAl1QBGSgxgpMQLjCQHIiMTBOPTjN9K"
    "JuJS4sADAOgbBxlBsfXrAAAAAElFTkSuQmCC"
    )

collapse = PyEmbeddedImage(
    "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAAZiS0dE"
    "AP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9oCBRMnAPbKmfcAAABB"
    "SURBVDjLY2AYBcMAMKJwmBj+//9HhCYmBob//yB6GbFI4jUEWTNWA6DgP9GuxqPwPyHNhAxA"
    "N4SR3ID+P8wTEgBwLg4FdgEHxgAAAABJRU5ErkJggg=="
    )
    

EvtIconClick, EVT_ICON_CLICK = NewEvent()
EvtIconToggle, EVT_ICON_TOGGLE = NewEvent()

wxEVT_PG_CHANGED = wx.NewEventType()
EVT_PG_CHANGED = wx.PyEventBinder( wxEVT_PG_CHANGED, 0 )

wxEVT_PG_RIGHT_CLICK = wx.NewEventType()
EVT_PG_RIGHT_CLICK = wx.PyEventBinder( wxEVT_PG_RIGHT_CLICK, 0 )


class FloatValidator( wx.PyValidator ):
    def __init__( self, *args, **kwargs ):
        wx.PyValidator.__init__( self, *args, **kwargs )
        self.Bind( wx.EVT_CHAR, self.OnChar )

    def Clone( self ):
Пример #11
0
import wx
from wx.lib.newevent import NewEvent

from nuxhash import nicehash, settings
from nuxhash.devices.nvidia import enumerate_devices as nvidia_devices
from nuxhash.gui.mining import MiningScreen
from nuxhash.gui.settings import SettingsScreen
from nuxhash.miners.excavator import Excavator
from nuxhash.switching.naive import NaiveSwitcher

PADDING_PX = 10
MINING_UPDATE_SECS = 5
BALANCE_UPDATE_MIN = 5
CONFIG_DIR = settings.DEFAULT_CONFIGDIR

NewBalanceEvent, EVT_BALANCE = NewEvent()
MiningStatusEvent, EVT_MINING_STATUS = NewEvent()


class MainWindow(wx.Frame):
    def __init__(self, parent, *args, **kwargs):
        wx.Frame.__init__(self, parent, *args, **kwargs)
        self.SetSizeHints(minW=500, minH=500)
        self._devices = []
        self._settings = None
        self._benchmarks = None
        notebook = wx.Notebook(self)

        self._mining_screen = MiningScreen(notebook,
                                           devices=self._devices,
                                           window=self)
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE."""

import wx
import wx.html
from wx.lib.newevent import NewEvent

__author__ = "Toni Ruža <*****@*****.**>"
__url__ = "http://bitbucket.org/raz/wxautocompletectrl"

(ValueChangedEvent, EVT_VALUE_CHANGED) = NewEvent()


def list_completer(a_list):
    template = "%s<b>%s</b>%s"

    def completer(query):
        formatted, unformatted = list(), list()
        if query:
            unformatted = [item for item in a_list if query in item]
            for item in unformatted:
                s = item.find(query)
                formatted.append(template %
                                 (item[:s], query, item[s + len(query):]))

        return formatted, unformatted
Пример #13
0
from unittest.mock import Mock, call

from pytest import mark
import wx
from wx.lib.newevent import NewEvent

from wxviews.widgets.setters import bind

CustomEvent, EVT_CUSTOM_EVENT = NewEvent()


class BindTests:
    """bind() tests"""

    @staticmethod
    @mark.parametrize('event_key, command, args', [
        ('EVT_MOVE', print, None),
        ('EVT_MENU', lambda ev: None, {'id': 105}),
        ('EVT_BUTTON', lambda ev: 2 + 2, {'arg': 'a'})
    ])
    def test_binds_commands(event_key: str, command, args: dict):
        """should call bind method of node with event and command"""
        node = Mock()
        args = {} if args is None else args
        value = (command, args) if args else command
        bind(node, event_key, value)

        assert node.bind.call_args == call(wx.__dict__[event_key], command, **args)
Пример #14
0
# -*- coding: utf-8 -*-

import logging
import os.path
from typing import Union

import wx
from wx.lib.newevent import NewEvent

from outwiker.core.defines import ICON_DEFAULT
from outwiker.core.system import getBuiltinImagePath
from outwiker.core.iconcontroller import IconController

IconSelectedEvent, EVT_ICON_SELECTED = NewEvent()


class IconButton(object):
    """
    Button with single icons
    """
    def __init__(self, parent, fname, width, height, theme=None):
        self._parent = parent
        self._fname = fname
        self._width = width
        self._height = height

        self._invalidFileName = getBuiltinImagePath('cross.png')

        self._normalBackground = wx.Colour(255, 255, 255)
        self._selectedBackground = wx.Colour(160, 190, 255)
        self._borderColor = wx.Colour(0, 0, 255)
Пример #15
0
__author__ = 'jmeline'

from wx.lib.newevent import NewEvent

wxCreateBox, EVT_CREATE_BOX = NewEvent()

wxUpdateConsole, EVT_UPDATE_CONSOLE = NewEvent()

from threadManager import ThreadManager

Пример #16
0
from importlib import reload
from dataclasses import dataclass, field
from typing import Any
import queue as Queue
import ps10
reload(ps10)
import wx
from wx.lib.newevent import NewEvent
from ps10 import *
from threading import Thread

WordSubmission, EVT_WORD_SUBMISSION = NewEvent()


class ModeFrame(wx.Frame):
    """
    This class is the main game mode selection menu.  It is the first window
    displayed, and is also re-displayed after each game.
    """
    def __init__(self):
        """
        Build up the GUI.
        """
        wx.Frame.__init__(
            self,
            parent=None,
            title='6.00 Word Game',
            size=(400, 80),
            style=wx.DEFAULT_FRAME_STYLE
            & ~(wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX))
        # Create the three buttons side by side; each one starts a different
Пример #17
0
import tempfile
import wx
import uuid
from wx.lib.newevent import NewEvent

from grass.script import core as gcore
from grass.script import raster as grast
from grass.exceptions import CalledModuleError, ScriptError
from grass.pydispatch.signal import Signal

from core.gcmd import GError, GMessage
from core.settings import UserSettings
from core.gthread import gThread
from rdigit.dialogs import NewRasterDialog

updateProgress, EVT_UPDATE_PROGRESS = NewEvent()


class RDigitController(wx.EvtHandler):
    """Controller object for raster digitizer.
    Inherits from EvtHandler to be able to send wx events from thraed.
    """
    def __init__(self, giface, mapWindow):
        """Constructs controller

        :param giface: grass interface object
        :param mapWindow: instance of BufferedMapWindow
        """
        wx.EvtHandler.__init__(self)
        self._giface = giface
        self._mapWindow = mapWindow
Пример #18
0
# CRISTIAN ECHEVERRÍA RABÍ

import weakref
import wx
from wx.lib.newevent import NewEvent

#-----------------------------------------------------------------------------------------

__all__ = ['ListCtrl', 'LISTCTRL_DEF_STYLE', 'EVTC_LISTCTRL_DATACHANGE']

#-----------------------------------------------------------------------------------------

myEvent, EVTC_LISTCTRL_DATACHANGE = NewEvent()
LISTCTRL_DEF_STYLE = wx.LC_VRULES | wx.LC_SINGLE_SEL

#-----------------------------------------------------------------------------------------


class ListCtrl(wx.ListCtrl):
    def __init__(self,
                 parent,
                 headers,
                 size=(-1, -1),
                 style=LISTCTRL_DEF_STYLE):
        """
        headers : Headers objects list
        size  : ListCtrl size
        style : ListCtrl styles
        """
        style = wx.LC_VIRTUAL | wx.LC_REPORT | style
Пример #19
0
(C) 2011 by the GRASS Development Team

This program is free software under the GNU General Public License
(>=v2). Read the file COPYING that comes with GRASS for details.

@author Anna Kratochvilova <kratochanna gmail.com> 
"""

import os
import copy

import wx
from wx.lib.newevent import NewEvent

wxAnimationFinished, EVT_ANIM_FIN = NewEvent()
wxAnimationUpdateIndex, EVT_ANIM_UPDATE_IDX = NewEvent()


class Animation:
    """!Class represents animation as a sequence of states (views).
    It enables to record, replay the sequence and finally generate
    all image files. Recording and replaying is based on timer events.
    There is no frame interpolation like in the Tcl/Tk based Nviz.
    """
    def __init__(self, mapWindow, timer):
        """!Animation constructor
        
        @param mapWindow glWindow where rendering takes place
        @param timer timer for recording and replaying
        """
Пример #20
0
# -*- coding: UTF-8 -*-

import wx
from wx.lib.newevent import NewEvent

PopupButtonMenuClick, EVT_POPUP_BUTTON_MENU_CLICK = NewEvent()


# Added in outwiker.gui 1.3
class PopupButton(wx.Panel):
    def __init__(self, parent, bitmap):
        super(PopupButton, self).__init__(parent)
        # Key - menu item's id
        # Value - user's object
        self._items = {}
        self._createGUI(bitmap)
        self.Bind(wx.EVT_MENU, handler=self._onMenuClick)

    def appendMenuItem(self, title, obj):
        menuitem_id = wx.NewId()
        self._items[menuitem_id] = obj
        self._menu.Append(menuitem_id, title)

    def _createGUI(self, bitmap):
        self._menu = wx.Menu()
        self._button = wx.BitmapButton(self, wx.ID_ANY, bitmap)
        self._button.Bind(wx.EVT_BUTTON, handler=self._onButtonClick)

        sizer = wx.FlexGridSizer(cols=1)
        sizer.AddGrowableCol(0)
        sizer.AddGrowableRow(0)
Пример #21
0
You should have received a copy of the GNU General Public License
along with the TroveNewspapers package. If not, see <http://www.gnu.org/licenses/>.
'''

from __future__ import with_statement
import wx, threading, Queue, sys, re, string, datetime, os
from wx.lib.newevent import NewEvent
import wx.html as html
import ConfigParser

import harvest
import icons
import help

ID_BEGIN = 100
wxStdOut, EVT_STDDOUT = NewEvent()
wxWorkerDone, EVT_WORKER_DONE = NewEvent()
wxHarvestResult, EVT_HARVEST_RESULT = NewEvent()


def do_harvest(**kwargs):
    '''
    Initiate the harvest, log the details and display results.
    '''
    project_name = kwargs['project_name']
    directory = kwargs['directory']
    # Convert the project name to a valid filename
    valid_chars = "-_.() %s%s" % (string.ascii_letters, string.digits)
    filename = project_name.lower().replace(' ', '_')
    filename = ''.join(c for c in filename if c in valid_chars)
    cfg_file = os.path.join(directory, '%s.ini' % filename)
import requests
import wx
from wx.lib.newevent import NewEvent
import os
from paths import update_path
from threading import Thread
import shutil
import subprocess
import sys

ProgressChangedEvent, EVT_PROGRESS_CHANGED = NewEvent()
DownloadFinishedEvent, EVT_DOWNLOAD_FINISHED = NewEvent()


class UpdateDialog(wx.Dialog):
    def __init__(self, parent, url):
        super().__init__(None, title=_("تنزيل التحديثات"))
        self.CentreOnParent()

        panel = wx.Panel(self)
        self.status = wx.TextCtrl(panel,
                                  -1,
                                  value=_("في انتظار بدء التحميل..."),
                                  style=wx.TE_READONLY | wx.TE_MULTILINE
                                  | wx.HSCROLL)
        cancelButton = wx.Button(panel, wx.ID_CANCEL, _("إيقاف التحميل"))
        self.progress = wx.Gauge(panel, -1, range=100)
        self.progress.Bind(EVT_PROGRESS_CHANGED, self.onChanged)
        self.Bind(EVT_DOWNLOAD_FINISHED, self.onFinished)
        cancelButton.Bind(wx.EVT_BUTTON, self.onCancel)
        self.Bind(wx.EVT_CLOSE, self.onClose)
Пример #23
0
    def onEscape(self, event):
        self.EndModal(wx.ID_CANCEL)

    def onEnter(self, event=None):
        self.EndModal(wx.ID_OK)

    def ShowModal(self):
        if self.timeout:
            timeout = wx.CallLater(self.timeout, self.onEnter)
            timeout.Start()
        return wx.Dialog.ShowModal(self)


# Event for GlobSizer-----------------------------------------------------
(GBSizerExLayoutEvent, EVT_GBSIZEREX_LAYOUT) = NewEvent()


class GlobSizer(wx.GridBagSizer):
    """This is a GridBagSizer that supports adding/removing/inserting rows and
    columns. It was found online, with not clear use license (public domain?).
    Appears to have been written by e.a.tacao <at> estadao.com.br
    """
    def __init__(self, *args, **kwargs):
        self.win = kwargs.pop("win", None)
        # This is here because we need to be able to find out whether a
        # row/col is growable. We also override the AddGrowableRow/Col and
        # RemoveGrowableRow/Col methods, as well as create new methods to
        # handle growable row/cols.
        self.growableRows = {}
        self.growableCols = {}
Пример #24
0
    """
    # DEFAULT_WIND file should not be required until you do something
    # that actually uses them. The check is just a heuristic; a directory
    # containing a PERMANENT/DEFAULT_WIND file is probably a GRASS
    # location, while a directory lacking it probably isn't.
    # TODO: perhaps we can relax this and require only permanent
    return os.access(os.path.join(location,
                                  "PERMANENT", "DEFAULT_WIND"), os.F_OK)


def location_name_from_url(url):
    """Create location name from URL"""
    return url.rsplit('/', 1)[1].split('.', 1)[0].replace("-", "_").replace(" ", "_")


DownloadDoneEvent, EVT_DOWNLOAD_DONE = NewEvent()


class LocationDownloadPanel(wx.Panel):
    """Panel to select and initiate downloads of locations.

    Has a place to report errors to user and also any potential problems
    before the user hits the button.

    In the future, it can potentially show also some details about what
    will be downloaded. The choice widget can be also replaced.

    For the future, there can be multiple panels with different methods
    or sources, e.g. direct input of URL. These can be in separate tabs
    of one panel (perhaps sharing the common background download and
    message logic).
Пример #25
0
        vbox = wx.BoxSizer(wx.VERTICAL)
        hbox = wx.BoxSizer(wx.HORIZONTAL)

        hbox.Add(label, 1, wx.ALIGN_BOTTOM, 10)

        vbox.Add(panel, 1, wx.ALIGN_CENTRE_HORIZONTAL | wx.LEFT | wx.RIGHT, 10)
        vbox.Add(self.bar, 0, wx.EXPAND | wx.ALIGN_TOP | wx.ALL, 10)
        vbox.Add(wx.Panel(self), 1, wx.EXPAND, 10)

        panel.SetSizer(hbox)
        self.SetSizer(vbox)


#==============================================================================
PortSelectedEvent, EVT_PORT_SELECTED = NewEvent()


class PortSelectionPanel(wx.Panel):
    def __init__(self, parent, device):
        super(PortSelectionPanel, self).__init__(parent)
        self.device = device
        self.InitUI()

    def InitUI(self):
        box = wx.BoxSizer(wx.VERTICAL)

        self.listbox = wx.ListBox(self)
        self.listbox.Bind(wx.EVT_LISTBOX_DCLICK, self.OnOK)
        self.listbox.Bind(wx.EVT_LISTBOX, self.OnSelectionChange)
Пример #26
0
from wx.lib.newevent import NewEvent

import grass.script as grass
from grass.script import task as gtask

from grass.pydispatch.signal import Signal

from core import globalvar
from core.gcmd import CommandThread, GError, GException
from gui_core.forms import GUI
from core.debug import Debug
from core.settings import UserSettings
from core.giface import Notification
from gui_core.widgets import FormNotebook

wxCmdOutput, EVT_CMD_OUTPUT = NewEvent()
wxCmdProgress, EVT_CMD_PROGRESS = NewEvent()
wxCmdRun, EVT_CMD_RUN = NewEvent()
wxCmdDone, EVT_CMD_DONE = NewEvent()
wxCmdAbort, EVT_CMD_ABORT = NewEvent()
wxCmdPrepare, EVT_CMD_PREPARE = NewEvent()


def GrassCmd(cmd, env=None, stdout=None, stderr=None):
    """Return GRASS command thread"""
    return CommandThread(cmd, env=env, stdout=stdout, stderr=stderr)


class CmdThread(threading.Thread):
    """Thread for GRASS commands"""
Пример #27
0
# -*- coding: utf-8 -*-

import os.path

import wx
from wx.lib.newevent import NewEvent

from outwiker.core.system import getImagesDir
from outwiker.core.tagscommands import getTagsString, parseTagsList
from outwiker.gui.tagscloud import TagsCloud
from outwiker.gui.taglabel import EVT_TAG_LEFT_CLICK

TagsListChangedEvent, EVT_TAGS_LIST_CHANGED = NewEvent()


class TagsSelector(wx.Panel):
    def __init__(self, parent):
        super(TagsSelector, self).__init__(parent)

        self.__tagsWidth = 350
        self.__tagsHeight = 150

        self.__tagBitmap = wx.Bitmap(os.path.join(getImagesDir(), "tag.png"),
                                     wx.BITMAP_TYPE_PNG)

        self.label_tags = wx.StaticText(self, -1, _(u"Tags (comma separated)"))

        self.tagsTextCtrl = wx.TextCtrl(self, -1, "")
        self.tagsTextCtrl.SetMinSize((250, -1))

        self.__tagsCloud = TagsCloud(self)
Пример #28
0
# AnalogClock's font selector for setup dialog
#   E. A. Tacao <e.a.tacao |at| estadao.com.br>
#   http://j.domaindlx.com/elements28/wxpython/
#   15 Fev 2006, 22:00 GMT-03:00
# Distributed under the wxWidgets license.

import wx
from wx.lib.newevent import NewEvent
from wx.lib.buttons import GenButton

#----------------------------------------------------------------------------

(FontSelectEvent, EVT_FONTSELECT) = NewEvent()

#----------------------------------------------------------------------------


class FontSelect(GenButton):
    def __init__(self, parent, size=(75, 21), value=None):
        GenButton.__init__(self,
                           parent,
                           wx.ID_ANY,
                           label="Select...",
                           size=size)
        self.SetBezelWidth(1)

        self.parent = parent
        self.SetValue(value)

        self.parent.Bind(wx.EVT_BUTTON, self.OnClick, self)
Пример #29
0
# -*- coding: utf-8; -*-

import wx
import imaplib
import socket
import urllib.request
import urllib.error
import json
import threading
import logging

from time import sleep
from wx.lib.newevent import NewEvent

StatusChangedEvent, EVT_STATUS_CHANGED = NewEvent()


class Mode(object):
    def __init__(self):
        self._evt_transport = wx.Frame(wx.GetApp().GetTopWindow())

    def bind(self, evt, handler):
        self._evt_transport.Bind(evt, handler)

    def unbind(self, evt, handler):
        self._evt_transport.Unbind(evt, handler=handler)

    def _post_event(self, event):
        if isinstance(self._evt_transport, wx.EvtHandler):
            wx.PostEvent(self._evt_transport, event)
Пример #30
0
import threading
import time

import wx
from wx.lib.newevent import NewEvent

import sys

if sys.version_info.major == 2:
    import Queue
else:
    import queue as Queue

from core.gconsole import EVT_CMD_DONE, wxCmdDone

wxThdTerminate, EVT_THD_TERMINATE = NewEvent()


class gThread(threading.Thread, wx.EvtHandler):
    """Thread for various backends

    terminating thread:
    https://www.geeksforgeeks.org/python-different-ways-to-kill-a-thread/
    """

    requestId = 0

    def __init__(self, requestQ=None, resultQ=None, **kwds):
        wx.EvtHandler.__init__(self)
        self.terminate = False
        self._terminate_evt = None