|
|
@ -2,7 +2,7 @@
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
authors: Pau1us <paulus.mail@oleco.net>
|
|
|
|
authors: Pau1us <paulus.mail@oleco.net>
|
|
|
|
license: gpl v2 or later
|
|
|
|
license: gpl v2 or later
|
|
|
|
PyBat is a tool to set usb in host or devices mode aund to set the charging speed.
|
|
|
|
auxmenu is a small menu to mute the phone, take screenshots, lock the display, send to standby and shutdown. It is intended to appear, if AUX is pressed.
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
import ecore
|
|
|
|
import ecore
|
|
|
@ -14,49 +14,14 @@ import e_dbus
|
|
|
|
import time
|
|
|
|
import time
|
|
|
|
from dbus import SystemBus, Interface
|
|
|
|
from dbus import SystemBus, Interface
|
|
|
|
|
|
|
|
|
|
|
|
# Parse command line
|
|
|
|
|
|
|
|
from optparse import OptionParser
|
|
|
|
if ecore.evas.engine_type_supported_get("software_x11_16"):
|
|
|
|
|
|
|
|
|
|
|
|
def parse_geometry(option, opt, value, parser):
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
w, h = value.split("x")
|
|
|
|
|
|
|
|
w = int(w)
|
|
|
|
|
|
|
|
h = int(h)
|
|
|
|
|
|
|
|
except Exception, e:
|
|
|
|
|
|
|
|
raise optparse.OptionValueError("Invalid format for %s" % option)
|
|
|
|
|
|
|
|
parser.values.geometry = (w, h)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
usage = "usage: %prog [options]"
|
|
|
|
|
|
|
|
op = OptionParser(usage=usage)
|
|
|
|
|
|
|
|
op.add_option("-e", "--engine", type="choice",
|
|
|
|
|
|
|
|
choices=("x11", "x11-16"), default="x11-16",
|
|
|
|
|
|
|
|
help=("which display engine to use (x11, x11-16), "
|
|
|
|
|
|
|
|
"default=%default"))
|
|
|
|
|
|
|
|
op.add_option("-n", "--no-fullscreen", action="store_true",
|
|
|
|
|
|
|
|
help="do not launch in fullscreen")
|
|
|
|
|
|
|
|
op.add_option("-g", "--geometry", type="string", metavar="WxH",
|
|
|
|
|
|
|
|
action="callback", callback=parse_geometry,
|
|
|
|
|
|
|
|
default=(480, 640),
|
|
|
|
|
|
|
|
help="use given window geometry")
|
|
|
|
|
|
|
|
op.add_option("-f", "--fps", type="int", default=50,
|
|
|
|
|
|
|
|
help="frames per second to use, default=%default")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Handle options and create output window
|
|
|
|
|
|
|
|
options, args = op.parse_args()
|
|
|
|
|
|
|
|
if options.engine == "x11":
|
|
|
|
|
|
|
|
f = ecore.evas.SoftwareX11
|
|
|
|
|
|
|
|
elif options.engine == "x11-16":
|
|
|
|
|
|
|
|
if ecore.evas.engine_type_supported_get("software_x11_16"):
|
|
|
|
|
|
|
|
f = ecore.evas.SoftwareX11_16
|
|
|
|
f = ecore.evas.SoftwareX11_16
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
print "warning: x11-16 is not supported, fallback to x11"
|
|
|
|
print "warning: x11-16 is not supported, fallback to x11"
|
|
|
|
f = ecore.evas.SoftwareX11
|
|
|
|
f = ecore.evas.SoftwareX11
|
|
|
|
|
|
|
|
ee = f(w=640, h=480)
|
|
|
|
w, h = options.geometry
|
|
|
|
ee.fullscreen = 1
|
|
|
|
ee = f(w=w, h=h)
|
|
|
|
|
|
|
|
ee.fullscreen = 1 # not options.no_fullscreen
|
|
|
|
|
|
|
|
edje.frametime_set(1.0 / options.fps)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Load and setup UI
|
|
|
|
# Load and setup UI
|
|
|
@ -84,17 +49,6 @@ def resize_cb(ee):
|
|
|
|
ee.callback_resize = resize_cb
|
|
|
|
ee.callback_resize = resize_cb
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def key_down_cb(bg, event, ee):
|
|
|
|
|
|
|
|
k = event.key
|
|
|
|
|
|
|
|
if k == "Escape":
|
|
|
|
|
|
|
|
ecore.main_loop_quit()
|
|
|
|
|
|
|
|
if k in ("F6", "f"):
|
|
|
|
|
|
|
|
ee.fullscreen = not ee.fullscreen
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
edje_obj.on_key_down_add(key_down_cb, ee)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class auxmenuclass:
|
|
|
|
class auxmenuclass:
|
|
|
|
def __init__(self, edje_obj):
|
|
|
|
def __init__(self, edje_obj):
|
|
|
|
print "init"
|
|
|
|
print "init"
|
|
|
@ -119,7 +73,6 @@ class auxmenuclass:
|
|
|
|
menu = auxmenuclass(edje_obj)
|
|
|
|
menu = auxmenuclass(edje_obj)
|
|
|
|
|
|
|
|
|
|
|
|
edje_obj.signal_callback_add("*", "button", menu.button_pressed)
|
|
|
|
edje_obj.signal_callback_add("*", "button", menu.button_pressed)
|
|
|
|
#edje_obj.signal_callback_add("StopSelected", "*", icon_selected)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|