Beispiel #1
0
 def open_input(self):
     """Opens the input dialog.
     """
     if ui.touch_enabled():
         self.input_dialog.execute()
     else:
         ui.note(_(u"Touch not enabled."), "error")
 def test_touch_enabled(self):
     """Test if touch is enabled on the device"""
     try:
         if appuifw.touch_enabled():
             print "Yes. It is!"
         else:
             print "No!"
     except:
         self.fail("touch_enabled() not working")
Beispiel #3
0
def set_defaults():
    appuifw.app.body = my_console.text
    appuifw.app.title = u'Python'
    sys.stderr = sys.stdout = my_console
    appuifw.app.screen = 'normal'
    appuifw.app.orientation = 'automatic'
    if appuifw.touch_enabled():
        appuifw.app.directional_pad = True
    else:
        appuifw.app.directional_pad = False
    init_options_menu()
def set_defaults():
    appuifw.app.body = my_console.text
    appuifw.app.title = u'Python'
    sys.stderr = sys.stdout = my_console
    appuifw.app.screen = 'normal'
    appuifw.app.orientation = 'automatic'
    if appuifw.touch_enabled():
        appuifw.app.directional_pad = True
    else:
        appuifw.app.directional_pad = False
    init_options_menu()
Beispiel #5
0
    def __init__(self):
        ''' Default values '''
        self.my_time = "hh:mm:ss"
        self.user_set = MySettings(FILE_SET)
        #self.t_timer = e32.Ao_timer()

        # Helper variables to position digits on-screen
        self.dx = 0
        self.dy = 0
        self.loc = []

        # Graphics mask by JOM, derivate work from original graphics
        tmp = graphics.Image.open(FILE_PATH + u"nix_mask100.jpg")
        self.mask = graphics.Image.new((XX,YY), mode='L')
        self.mask.blit(tmp)

        # Digit graphics
        self.digit = [None, None, None, None, None, None, None, None, None, None]
        for i in range(10):
            self.digit[i] = graphics.Image.new((XX, YY))
        self.change_color(self.user_set.color())

        #appuifw.app.orientation = 'portrait'
        appuifw.app.screen = 'full'
        appuifw.app.title = u'Nixie Watch'
        appuifw.app.exit_key_handler = self.cb_quit
        appuifw.app.focus = cb_focus
        appuifw.app.menu = [
            (u"Change Color", self.menu_settings),
            (u"About", self.menu_about),
            (u"Exit", self.cb_quit)
        ]

        if e32.pys60_version_info > (1,9):
            # Hide annoying virtual keypad
            # HOX: seems like must be before creating canvas
            appuifw.app.directional_pad = False

        global canvas
        canvas = appuifw.Canvas(
            resize_callback = cb_resize,
            redraw_callback = cb_redraw)
        appuifw.app.body = canvas

        if e32.pys60_version_info > (1,9):
            if appuifw.touch_enabled():
                # Full screen, even when rotated
                a = max(canvas.size)
                canvas.bind(key_codes.EButton1Down, self.cb_touch, ((0,0), (a, a)))

        # Disable screensaver
        handle_screensaver()
Beispiel #6
0
    def __init__(self):
        ''' Default values '''
        self.my_time = "hh:mm:ss"
        self.user_set = MySettings(FILE_SET)
        #self.t_timer = e32.Ao_timer()

        # Helper variables to position digits on-screen
        self.dx = 0
        self.dy = 0
        self.loc = []

        # Graphics mask by JOM, derivate work from original graphics
        tmp = graphics.Image.open(FILE_PATH + u"nix_mask100.jpg")
        self.mask = graphics.Image.new((XX, YY), mode='L')
        self.mask.blit(tmp)

        # Digit graphics
        self.digit = [
            None, None, None, None, None, None, None, None, None, None
        ]
        for i in range(10):
            self.digit[i] = graphics.Image.new((XX, YY))
        self.change_color(self.user_set.color())

        #appuifw.app.orientation = 'portrait'
        appuifw.app.screen = 'full'
        appuifw.app.title = u'Nixie Watch'
        appuifw.app.exit_key_handler = self.cb_quit
        appuifw.app.focus = cb_focus
        appuifw.app.menu = [(u"Change Color", self.menu_settings),
                            (u"About", self.menu_about),
                            (u"Exit", self.cb_quit)]

        if e32.pys60_version_info > (1, 9):
            # Hide annoying virtual keypad
            # HOX: seems like must be before creating canvas
            appuifw.app.directional_pad = False

        global canvas
        canvas = appuifw.Canvas(resize_callback=cb_resize,
                                redraw_callback=cb_redraw)
        appuifw.app.body = canvas

        if e32.pys60_version_info > (1, 9):
            if appuifw.touch_enabled():
                # Full screen, even when rotated
                a = max(canvas.size)
                canvas.bind(key_codes.EButton1Down, self.cb_touch,
                            ((0, 0), (a, a)))

        # Disable screensaver
        handle_screensaver()
Beispiel #7
0
	def __init__(self, canvas, sprite_path = 'e:\\data\\python\\sprite.png', frame_size = (117, 40)):
		self.canvas = canvas
		self.sprite = Image.open(sprite_path)
		self.layer = Image.new(self.canvas.size)
		
		self.curr_frame = 0
		self.frame_w = frame_size[0]
		self.frame_h = frame_size[1]
		
		self.loader_pos = ( (self.layer.size[0] - self.frame_w) / 2, (self.layer.size[1] - self.frame_h) / 2)
		self.busy = True
		
		self.is_toush = appuifw.touch_enabled()
Beispiel #8
0
 def init_gui(self):
   if not appuifw.touch_enabled():
     self.buttons = None
     return
   
   size = self.canvas.size
   top = 40
   bottom = size[1] - 60
   space = 20
   width = (size[0] - 2 * space) / 3
   
   self.buttons = ((0, top), (width, bottom), # Left button
                   (width + space, top), (width * 2 + space, bottom), # Middle button
                   (width * 2 + space * 2, top), (width * 3 + space * 2, bottom), # Right button
                   (0, space + bottom), (width, size[1]), # Edit button
                   (width + space, space + bottom), (width * 2 + space, size[1]), # Remove (C)
                   (width * 2 + space * 2, space + bottom), (width * 3 + space * 2, size[1])) # New line (0)
Beispiel #9
0
    def __init__(self):
        
        self.connected = False
        self.deviceID = ""
        self.running = False
               
        #Create menu and wait for user input
        appuifw.app.screen='normal'
        appuifw.app.menu=[(u'Play',self.playSong),(u'Stop',self.stopSong),(u'Forward',self.forwardSong),(u'Exit',self.exit_handler)]
        
        appuifw.app.directional_pad = False    
        appuifw.app.exit_key_handler = self.exit_handler 
  	
        if appuifw.touch_enabled():
            self.deviceID = "nokiaXM"
        else:
            self.deviceID = "nokiaN95"
	
        self.running = True
Beispiel #10
0
    def init_ui(self):
        """Initializes the user interface.
        """
        self.tabs = [
            (_(u"Apps"), self.open_apps),
        ]

        self.menu = [
            (_(u"Orientation"), (
                (_(u"Automatic"), self.set_orientation("automatic")),
                (_(u"Landscape"), self.set_orientation("landscape")),
                (_(u"Portrait") , self.set_orientation("portrait")),
            )),
            (_(u"Disconnect"), self.back)
        ]

        # Dialogs
        self.apps_dialog = ApplicationsDialog(self.app, self)
        if ui.touch_enabled():
            # Only works with touch-enabled devices
            self.input_dialog = InputDialog(self.app, self)
            self.tabs.append((_(u"Input"), self.open_input))
Beispiel #11
0
                self.z_coord = -18.0
            else:
                self.z_coord = -26.0
            self.x_max = self.canvas.size[0]
            self.y_max = self.canvas.size[1]
            if self.gl_initialized:
                self.init_view()

    def set_exit(self):
        self.exitflag = True

    def cleanup(self):
        appuifw.app.body = self.old_body
        self.canvas = None
        appuifw.app.exit_key_handler = None

    def run(self):
        appuifw.app.exit_key_handler = self.set_exit
        while not self.exitflag:
            self.canvas.drawNow()
            e32.ao_sleep(0.0001)
        self.cleanup()


if __name__ == '__main__':
    if not appuifw.touch_enabled():
        appuifw.note(u"This only works on touch devices")
    else:
        gl_ball = GlesBall()
        gl_ball.run()
Beispiel #12
0
                elif self.orientation == 'portrait':
                    self.new_draw_img = self.draw_img.transpose(ROTATE_270)
                self.draw_img = None
                self.draw_img = Image.new(
                    (self.canvas.size[0], self.canvas.size[1]))
                self.draw_img.blit(self.new_draw_img)
                self.new_draw_img = None
                self.canvas.blit(self.draw_img)
                self.clear_button_bindings()
                if self.about_active:
                    self.clear_about_screen()
                self.bind_palette = True
                self.draw_buttons()
                self.bind_buttons()
                self.orientation_changed = False

        self.quit()

    def quit(self):
        appuifw.app.exit_key_handler = None
        self.running = False


if __name__ == '__main__':
    if not appuifw.touch_enabled():
        appuifw.note(u"This application only works on devices that support " +
                     u"touch input")
    else:
        d = PaintApp()
        d.run()
Beispiel #13
0
from datetime import date
from itertools import count

# These strings do not influence or on the app cold boot
# either on the plurk posting.
from sys import path as sysPath
sysPath.append('e:\\data\\python\\lib')
import FileUploader, simplejson

plurk_login = u'Plurk User'
plurk_password = '******'
version = u'0_1_1015'

limg = None
limg_path = u''
touch = appuifw.touch_enabled()

# special workaround for a proper camera orientation
if touch:
	appuifw.app.orientation = 'landscape'
	import camera
	appuifw.app.orientation = 'portrait'
else:
	import camera

# path = os.getcwd() + '\\'
# drive_letter = os.getcwd().split("\\")[0]
if not touch:
	path = u"c:\\data\python\\"
	appuifw.app.screen = 'normal'
	bgimage = Image.open(path + "bg.png")
Beispiel #14
0
RESDIR = u""
if e32.in_emulator():
    DEFDIR = os.path.join(os.path.dirname(sys.argv[0]),"wordmobi_tmp")
    if not os.path.exists(DEFDIR):
        os.makedirs(DEFDIR)
else:
    for d in e32.drive_list():
        appd = d + u"\\data\\python\\wordmobidir\\"
        if os.path.exists(appd + u"wordmobi.py"):
            DEFDIR = appd
            break
if DEFDIR:
    sys.path.append(DEFDIR)
    sys.path.append(os.path.join(DEFDIR,u"loc"))
    MIFFILE = os.path.join(DEFDIR,u"wordmobi.mif")
    PERSIST = os.path.join(DEFDIR,u"persist.bin")
    RESDIR = os.path.join(DEFDIR,u"res")
    
# checking touch UI
try:
    from appuifw import touch_enabled
    TOUCH_ENABLED = touch_enabled()
except:
    # python < 1.9.3 does not support touch ui
    TOUCH_ENABLED = False

# Use standard media gallery
MGFETCH = False