本文整理汇总了Python中scc.osd.OSDWindow类的典型用法代码示例。如果您正苦于以下问题:Python OSDWindow类的具体用法?Python OSDWindow怎么用?Python OSDWindow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OSDWindow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _add_arguments
def _add_arguments(self):
OSDWindow._add_arguments(self)
self.argparser.add_argument('-t', type=float, metavar="seconds",
default=5, help="time before message is hidden (default: 5; 0 means forever)")
self.argparser.add_argument('-s', type=int, metavar="size",
default=3, help="font size, in range 1 to 3 (default: 3)")
self.argparser.add_argument('text', type=str, help="text to display")
示例2: _add_arguments
def _add_arguments(self):
OSDWindow._add_arguments(self)
self.argparser.add_argument('image', type=str, nargs="?",
default = self.bdisplay, help="keyboard image to use")
self.argparser.add_argument('--cancel-with', type=str,
metavar="button", default='B',
help="button used to close display (default: B)")
示例3: __init__
def __init__(self, cls="osd-menu"):
OSDWindow.__init__(self, cls)
self.daemon = None
self.config = None
self.feedback = None
self.controller = None
self.xdisplay = X.Display(hash(GdkX11.x11_get_default_xdisplay())) # Magic
cursor = os.path.join(get_share_path(), "images", 'menu-cursor.svg')
self.cursor = Gtk.Image.new_from_file(cursor)
self.cursor.set_name("osd-menu-cursor")
self.parent = self.create_parent()
self.f = Gtk.Fixed()
self.f.add(self.parent)
self.add(self.f)
self._submenu = None
self._scon = StickController()
self._scon.connect("direction", self.on_stick_direction)
self._is_submenu = False
self._selected = None
self._menuid = None
self._use_cursor = False
self._eh_ids = []
self._control_with = STICK
self._control_with_dpad = False
self._confirm_with = 'A'
self._cancel_with = 'B'
示例4: show
def show(self, *a):
OSDWindow.show(self, *a)
self.profile.load(find_profile(".scc-osd.keyboard")).compress()
self.mapper = SlaveMapper(self.profile, keyboard=b"SCC OSD Keyboard")
self.mapper.set_special_actions_handler(self)
self.set_cursor_position(0, 0, self.cursors[LEFT], self.limits[LEFT])
self.set_cursor_position(0, 0, self.cursors[RIGHT], self.limits[RIGHT])
示例5: _add_arguments
def _add_arguments(self):
OSDWindow._add_arguments(self)
self.argparser.add_argument('--control-with', '-c', type=str,
metavar="option", default=DEFAULT, choices=(DEFAULT, LEFT, RIGHT, STICK),
help="which pad or stick should be used to navigate menu")
self.argparser.add_argument('--confirm-with', type=str,
metavar="button", default=DEFAULT,
help="button used to confirm choice")
self.argparser.add_argument('--cancel-with', type=str,
metavar="button", default=DEFAULT,
help="button used to cancel menu")
self.argparser.add_argument('--confirm-with-release', action='store_true',
help="confirm choice with button release instead of button press")
self.argparser.add_argument('--cancel-with-release', action='store_true',
help="cancel menu with button release instead of button press")
self.argparser.add_argument('--use-cursor', '-u', action='store_true',
help="display and use cursor")
self.argparser.add_argument('--size', type=int,
help="sets prefered width or height")
self.argparser.add_argument('--feedback-amplitude', type=int,
help="enables and sets power of feedback effect generated when active menu option is changed")
self.argparser.add_argument('--from-profile', '-p', type=str,
metavar="profile_file menu_name",
help="load menu items from profile file")
self.argparser.add_argument('--from-file', '-f', type=str,
metavar="filename",
help="load menu items from json file")
self.argparser.add_argument('--print-items', action='store_true',
help="prints menu items to stdout")
self.argparser.add_argument('items', type=str, nargs='*', metavar='id title',
help="Menu items")
示例6: quit
def quit(self, code=-2):
if self.get_controller():
self.get_controller().unlock_all()
for source, eid in self._eh_ids:
source.disconnect(eid)
self._eh_ids = []
OSDWindow.quit(self, code)
示例7: _add_arguments
def _add_arguments(self):
OSDWindow._add_arguments(self)
self.argparser.add_argument('--control-with', '-c', type=str,
metavar="option", default=STICK, choices=(LEFT, RIGHT, STICK),
help="which pad or stick should be used to navigate menu (default: %s)" % (STICK,))
self.argparser.add_argument('--confirm-with', type=str,
metavar="button", default='A',
help="button used to confirm choice (default: A)")
self.argparser.add_argument('--cancel-with', type=str,
metavar="button", default='B',
help="button used to cancel menu (default: B)")
self.argparser.add_argument('--confirm-with-release', action='store_true',
help="confirm choice with button release instead of button press")
self.argparser.add_argument('--cancel-with-release', action='store_true',
help="cancel menu with button release instead of button press")
self.argparser.add_argument('--use-cursor', '-u', action='store_true',
help="display and use cursor")
self.argparser.add_argument('--from-profile', '-p', type=str,
metavar="profile_file menu_name",
help="load menu items from profile file")
self.argparser.add_argument('--from-file', '-f', type=str,
metavar="filename",
help="load menu items from json file")
self.argparser.add_argument('--print-items', action='store_true',
help="prints menu items to stdout")
self.argparser.add_argument('items', type=str, nargs='*', metavar='id title',
help="Menu items")
示例8: __init__
def __init__(self):
OSDWindow.__init__(self, "osd-message")
self.timeout = OSDAction.DEFAULT_TIMEOUT
self.size = OSDAction.DEFAULT_SIZE
self.text = "text"
self._timeout_id = None
示例9: quit
def quit(self, code=-2):
if not self._is_submenu:
self.daemon.unlock_all()
for x in self._eh_ids:
self.daemon.disconnect(x)
self._eh_ids = []
OSDWindow.quit(self, code)
示例10: show
def show(self):
OSDWindow.show(self)
from ctypes import byref
pb = self.b.get_pixbuf()
win = X.XID(self.get_window().get_xid())
pixmap = X.create_pixmap(self.xdisplay, win,
pb.get_width(), pb.get_height(), 1)
width = pb.get_width()
height = pb.get_height()
self.f.move(self.cursor, int(width / 2), int(height / 2))
gc = X.create_gc(self.xdisplay, pixmap, 0, None)
X.set_foreground(self.xdisplay, gc, 0)
X.fill_rectangle(self.xdisplay, pixmap, gc, 0, 0, pb.get_width(), pb.get_height())
X.set_foreground(self.xdisplay, gc, 1)
X.set_background(self.xdisplay, gc, 1)
r = int(pb.get_width() * 0.985)
x = (pb.get_width() - r) / 2
X.fill_arc(self.xdisplay, pixmap, gc,
x, x, r, r, 0, 360*64)
X.flush_gc(self.xdisplay, gc)
X.flush(self.xdisplay)
X.shape_combine_mask(self.xdisplay, win, X.SHAPE_BOUNDING, 0, 0, pixmap, X.SHAPE_SET)
X.flush(self.xdisplay)
示例11: quit
def quit(self, code=-1):
self.daemon.unlock_all()
for x in self._eh_ids:
self.daemon.disconnect(x)
self._eh_ids = []
del self.keyboard
OSDWindow.quit(self, code)
示例12: __init__
def __init__(self, imagepath="/usr/share/scc/images"):
OSDWindow.__init__(self, "osd-menu")
self.daemon = None
self.config = None
self.hilights = { self.HILIGHT_COLOR : set(), self.OBSERVE_COLOR : set() }
self.imagepath = imagepath
self._eh_ids = []
示例13: show
def show(self, *a):
if self.background is None:
self.realize()
self.background = SVGWidget(self.args.image, init_hilighted=True)
self.c.add(self.background)
self.add(self.c)
OSDWindow.show(self, *a)
self.move(*self.compute_position())
示例14: __init__
def __init__(self):
self.exit_code = -1
self.mainloop = GLib.MainLoop()
self.config = None
self._window = None
self._registered = False
self._last_profile_change = 0
self._recent_profiles_undo = None
OSDWindow._apply_css()
示例15: show
def show(self):
self.l = Gtk.Label()
self.l.set_name("osd-label")
self.l.set_label(self.text)
self.add(self.l)
OSDWindow.show(self)
GLib.timeout_add_seconds(self.timeout, self.quit)