Exemplo n.º 1
0
import a2ahk
from PySide2 import QtGui, QtCore, QtWidgets
from .dialogs import _HotkeyDialogBase
import a2core

log = a2core.get_logger(__name__)
LEAVE_CLOSE_TIMEOUT = 1000
STYLE_BAD = '* {color:#F00}'
STYLE_GOOD = '* {color:#0F0}'
_dialog_size = None


class HotkeyDialog1(QtWidgets.QWidget, _HotkeyDialogBase):
    hotkey_set = QtCore.Signal(str)
    label = 'Simple Dialog'

    def __init__(self, parent, key, scope_data=None):
        # super(HotkeyDialog1, self).__init__(parent)
        QtWidgets.QWidget.__init__(self, parent)
        _HotkeyDialogBase.__init__(self, parent, key, scope_data)

        self.setup_ui()

        QtWidgets.QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Enter), self, self.ok)
        QtWidgets.QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Escape), self, self.close)

        self.setWindowFlags(QtCore.Qt.Window | QtCore.Qt.CustomizeWindowHint)

        self._close_timer = QtCore.QTimer()
        self._close_timer.setInterval(LEAVE_CLOSE_TIMEOUT)
        self._close_timer.timeout.connect(self.leave_timeout_reached)
Exemplo n.º 2
0
import os
import a2core

from PySide2 import QtGui, QtCore, QtSvg


log = a2core.get_logger(__name__)
ICO_PATH = None
DEFAULT_ALPHA = 0.6
LOW_ALPHA = 0.25


class Ico(QtGui.QIcon):
    def __init__(self, ico_name, px=512, alpha=None):
        """
        :param str ico_name: Name of the icon. If present in icon library the path is
            build there. Otherwise ico_name has to be a path to the image file.
        :param int px: Pre-render size of the icon image. Lower values than 512 might
            cause artifacts but might be more memory and loading speed friendly.
        :param float alpha: 0.0 to 1.0 transparency value for the icon image.
        """
        super(Ico, self).__init__()

        self.px = px

        self._tinted = None
        self._alpha = alpha

        self._painter = None
        self._image = None
Exemplo n.º 3
0
Arquivo: button.py Projeto: lipkau/a2
# -*- coding: utf-8 -*-
"""
Some element description ...

@created: 2016 11 14
@author: Eric Werner
"""
import a2ctrl
from PySide import QtGui
from a2element import DrawCtrl, EditCtrl, button_edit_ui
from a2core import get_logger
import traceback
import os


log = get_logger(__name__)


class Draw(DrawCtrl):
    """
    The frontend widget visible to the user with options
    to change the default behavior of the element.
    """
    def __init__(self, main, cfg, mod):
        super(Draw, self).__init__(main, cfg, mod)

        self.button_layout = QtGui.QHBoxLayout(self)
        labeltext = self.cfg.get('labeltext', '')
        if labeltext:
            label = QtGui.QLabel(labeltext)
            self.button_layout.addWidget(label)
Exemplo n.º 4
0
# -*- coding: utf-8 -*-
"""
Some element description ...

@created: 2016 11 14
@author: Eric Werner
"""
import a2ctrl
from PySide import QtGui
from a2element import DrawCtrl, EditCtrl, button_edit_ui
from a2core import get_logger
import traceback
import os

log = get_logger(__name__)


class Draw(DrawCtrl):
    """
    The frontend widget visible to the user with options
    to change the default behavior of the element.
    """
    def __init__(self, main, cfg, mod):
        super(Draw, self).__init__(main, cfg, mod)

        self.button_layout = QtGui.QHBoxLayout(self)
        labeltext = self.cfg.get('labeltext', '')
        if labeltext:
            label = QtGui.QLabel(labeltext)
            self.button_layout.addWidget(label)
Exemplo n.º 5
0
import os
import inspect

import a2ahk
import a2core
import a2util
import a2runtime
import a2ctrl.connect
from a2widget.a2hotkey import hotkey_common

from . import base_ui, mouse_ui, numpad_ui, cursor_block_ui

from PySide2 import QtGui, QtCore, QtWidgets


log = a2core.get_logger('keyboard_base')
BASE_MODIFIERS = ['alt', 'ctrl', 'shift', 'win']
SIDES = 'lr'
DB_KEY_MOUSE = 'hotkey_dialog_show_mouse'
DB_KEY_NUMPAD = 'hotkey_dialog_show_numpad'
_HERE = os.path.dirname(__file__)
_IGNORE_BUTTONS = ['a2cancel_button', 'a2ok_button']
HOTKEY_HELP_PAGE = 'Hotkey-Setup'
WIN_STANDARD_FILE = 'standard_windows_keys.json'
_WIN_STANDARD_KEYS = {}
GLOBAL_NO_MOD_WARNING = 'Global Hotkeys should have a modifier!'


class KeyboardDialogBase(QtWidgets.QDialog):

    def __init__(self, parent):