Exemple #1
0
    def run(self, window):
        frame = self.view(window, back_button=True)

        vbox = gui.Box(frame, axis=1)

        self.file_name = tichy.Text("No file")
        self.file_name.view(vbox)

        self.x_window = gui.XWindow(vbox)

        self.status_name = tichy.Text("")
        self.status_name.view(vbox)

        # We put a few buttons
        box = gui.Box(vbox, axis=0)
        play_button = gui.Button(box, optimal_size=gui.Vect(96, 96))
        tichy.Image(self.path('play.png')).view(play_button)
        pause_button = gui.Button(box, optimal_size=gui.Vect(96, 96))
        tichy.Image(self.path('pause.png')).view(pause_button)
        stop_button = gui.Button(box, optimal_size=gui.Vect(96, 96))
        tichy.Image(self.path('stop.png')).view(stop_button)
        open_button = gui.Button(box, optimal_size=gui.Vect(96, 96))
        tichy.Image(self.path('open.png')).view(open_button)

        stop_button.connect('clicked', self.on_stop)
        play_button.connect('clicked', self.on_play)
        pause_button.connect('clicked', self.on_pause)
        open_button.connect('clicked', self.on_open)

        frame.actor.new_action("Volume").connect('activated', self.on_volume)
        yield tichy.Wait(frame, 'back')
Exemple #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
Exemple #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')
Exemple #4
0
    def view_actor(self, parent, actor, **kargs):
        ret = gui.Button(parent, item=actor, holdable=1000, **kargs)
        hbox = gui.Box(ret, axis=0, border=0, spacing=0)
        if actor.item.icon:
            icon_path = actor.item.path(actor.item.icon)
            icon = tichy.Image(icon_path, size=Vect(96, 96)).view(hbox)
        else:
            gui.Widget(hbox, min_size=Vect(0, 96))
        text_box = gui.Box(hbox, axis=1, border=0, spacing=0)
        actor.item.get_text().view(text_box)
        sub_text = actor.get_sub_text()
        if sub_text:
            sub_text.view(text_box)

        def on_clicked(b, actor, self):
            self.select_actor(actor, b)

        ret.connect('clicked', on_clicked, actor, self)

        def on_holded(b, actor, self):
            self.select_actor(actor, b, use_default=False)

        ret.connect('holded', on_holded, actor, self)

        return ret
Exemple #5
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
Exemple #6
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
Exemple #7
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')
Exemple #8
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')
Exemple #9
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()
Exemple #10
0
    def view(self, parent):
        ### should I use actor?
        displayButton = gui.Button(parent)
        displayButtonBox = gui.Box(displayButton, axis=0)
        tichy.Image(self.get_icon_path(), size=Vect(96,
                                                    96)).view(displayButtonBox)
        tichy.Text(self.name).view(displayButtonBox)

        self.button = displayButton
        self.button.connect('clicked', self.on_click)
        return self.button
Exemple #11
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
Exemple #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()