Exemplo n.º 1
0
    def run(self, parent, title, msg):
        w = gui.Window(parent)

        frame = self.view(w, title=title)
        vbox = gui.Box(frame, axis=1, expand=True)
        gui.Label(vbox, msg, expand=True)

        b = gui.Button(vbox)
        gui.Label(b, 'OK')
        yield Wait(b, 'clicked')
        w.destroy()
Exemplo n.º 2
0
 def view(self, parent):
     box = gui.Box(parent, axis=0)
     gui.Label(box, self.name)
     self.text.view(box)
     inc = gui.Button(box)
     gui.Label(inc, '+')
     inc.connect('clicked', self._on_inc)
     dec = gui.Button(box)
     gui.Label(dec, '-')
     dec.connect('clicked', self._on_dec)
     return box
Exemplo n.º 3
0
    def run(self, window):
        """run the app

        The screen is spearated in on part showing the chunk of the
        text that can be read, and one part showing the possible
        actions : read, or get next chunk.

        The application also define a few actions to open a file, set
        the speed of the voice, etc.
        """
        self.file = None
        self.speed = 120
        self.voice = 'm1'

        frame = self.view(window, back_button=True)

        # create the app menu
        actor = frame.actor

        open_item = actor.new_action("Open")
        open_item.connect('activated', self.on_open)

        speed_item = actor.new_action("Speed")
        for speed in [50, 120, 170, 300]:
            item = speed_item.new_action("%d" % speed)
            item.connect('activated', self.on_set_speed, speed)

        voice_item = actor.new_action("Voice")
        for voice in ['m1', 'm2', 'f1', 'f2']:
            item = voice_item.new_action("%s" % voice)
            item.connect('activated', self.on_set_voice, voice)

        # Show the text zone
        vbox = gui.Box(frame, axis=1, expand=True)
        self.text = tichy.Text('')
        self.text.view(vbox, expand=True)
        hbox = gui.Box(vbox, axis=0)

        # Create the buttons
        read_button = gui.Button(hbox)
        gui.Label(read_button, "Read")
        read_button.connect('clicked', self.on_read)

        next_button = gui.Button(hbox)
        gui.Label(next_button, "Next")
        next_button.connect('clicked', self.on_next)

        # Wait till we quit
        yield tichy.Wait(frame, 'back')
Exemplo n.º 4
0
    def view(self, parent):
        ret = gui.Button(parent)
        gui.Label(ret, self.name)

        def on_clicked(w):
            self.browser.select_path(self.path)

        ret.connect('clicked', on_clicked)
        return ret
Exemplo n.º 5
0
    def view(self, parent):
        ret = gui.Button(parent)
        gui.Label(ret, self.value)

        def on_clicked(b):
            self.emit('selected')

        ret.connect('clicked', on_clicked)

        return ret
Exemplo n.º 6
0
    def run(self, window):
        frame = self.view(window, back_button=True)
        vbox = gui.Box(frame, axis=1, expand=True)

        button = gui.Button(vbox)
        gui.Label(button, "fake SMS")
        button.connect('clicked', self.on_fake_sms)

        # Wait until the quit button is clicked
        yield tichy.Wait(frame, 'back')
Exemplo n.º 7
0
    def run(self, window, card, correct):
        self.name = "Correct" if correct else "Wrong"
        frame = self.view(window)

        vbox = gui.Box(frame, axis=1)
        gui.Label(vbox, card.q, font_size=58)
        gui.Label(vbox, card.a)
        if card.comment:
            gui.Label(vbox, "(%s)" % card.comment)

        gui.Spring(vbox, axis=1)

        read_button = gui.Button(vbox)
        gui.Label(read_button, "Read")
        read_button.connect('clicked', self.on_read, card.a)

        next_button = gui.Button(vbox)
        gui.Label(next_button, "OK")

        yield tichy.tasklet.Wait(next_button, 'clicked')
Exemplo n.º 8
0
 def view(self, parent, same_as=None):
     size = Vect(self.rect[2] * 64, self.rect[3] * 64)
     pos = Vect(self.rect[0] * 64, self.rect[1] * 64)
     ret = gui.Button(parent, item=self, min_size=size, optimal_size=size,
                      pos=pos, same_as=same_as)
     # If we provided a widget for optimization, then we can also
     # use the widget child for next view
     if same_as is not None:
         same_as = same_as.children[0]
     gui.Label(ret, self.text, min_size=size, optimal_size=size,
               same_as=same_as)
     return ret
Exemplo n.º 9
0
    def run(self, parent):
        self.window = gui.Window(parent, modal=True)
        vbox = gui.Box(self.window, axis=1, border=0, spacing=0)
        self.lock_widget = ScreenLockWidget(vbox, Vect(480, 560))

        size = Vect(42, 42)
        gui.Label(vbox,
                  '       Trace the pattern to unlock',
                  min_size=size,
                  optimal_size=size)

        yield tichy.Wait(self.lock_widget, 'unlocked-screen')
        self.window.destroy()
Exemplo n.º 10
0
    def view(self, parent, **kargs):
        """Create a view of the Item

        :Parameters:
            `parent` : gui.Widget
                The parent widget the view will be created in

        :Returns: the widget that represents the item
        """
        ret = gui.Box(parent, axis=0, border=0)
        gui.Label(ret, "%s:" % self.field.name)
        if self.value:
            self.value.view(ret)
        return ret
Exemplo n.º 11
0
    def run(self, window, sms):
        frame = self.view(window, title="Message", back_button=True)
        vbox = gui.Box(frame, axis=1, expand=True)
        self.sms = sms

        # The destination field
        hbox = gui.Box(vbox, axis=0)
        gui.Label(hbox, "to:")
        self.sms.number.create_actor().view(hbox, expand=True)

        # The message
        self.sms.text.view(vbox, editable=True, expand=True)

        frame.actor.new_action("Send").connect('activated', self.on_send)

        yield tichy.Wait(frame, 'back')
Exemplo n.º 12
0
    def run(self, parent):
        #### build and layout ####
        mainWindow = gui.Window(parent, modal=True)
        appFrame = self.view(mainWindow, back_button=True)
        vbox = gui.Box(appFrame, axis=1, border=0)
        appListView = self.list.view(vbox)
        gui.Spring(vbox, axis=1)
        upButton = gui.Button(vbox)
        gui.Label(upButton, '.. previous menu ..')

        upButton.connect('clicked', self.go_up)

        #### retrieve app list ####
        self.generate_xdg_menu(xdg.Menu.parse())

        #### close button ####
        yield tichy.Wait(appFrame, 'back')
        mainWindow.destroy()
Exemplo n.º 13
0
 def view(self, parent):
     ret = gui.Box(parent, axis=0, border=0)
     gui.Label(ret, self.key)
     value = str(self.service[self.key])
     gui.Label(ret, value)
     return ret