Example #1
0
    def __init__(self):
        self.tray = gtk.StatusIcon()
        self.tray.connect('activate', self.refresh)

        # Create menu
        self.menu = gtk.Menu()

        i = gtk.MenuItem("Settings")
        self.settings_item = i
        i.show()
        i.connect("activate", self.ConfigurePiJuice)
        self.menu.append(i)

        i = gtk.MenuItem("About...")
        i.show()
        i.connect("activate", self.show_about)
        self.menu.append(i)

        self.tray.connect('popup-menu', self.show_menu)

        self.pijuice = PiJuice(1, 0x14)

        # Initalise and start battery display
        self.refresh(None)
        self.tray.set_visible(True)

        gobject.timeout_add(REFRESH_INTERVAL, self.refresh, self.tray)
        gobject.timeout_add(CHECK_SIGNAL_INTERVAL, self.check_signum)
Example #2
0
 def arm (self, manager):
   self.manager = manager
   props = dict(obj=self.remote.path, name=self.remote.item.name, expected=self.when.isoformat( ), **self.remote.item.fields)
   self.props = props
   new_path = PATH + '/Scheduler/Armed/' + self.hashed
   delay_ms = (self.when - datetime.datetime.now( )).total_seconds( ) * 1000
   self.remote.bus.add_signal_receiver(self.cleanup, "Remove", dbus_interface=Trigger.OWN_IFACE, bus_name=BUS, path=new_path)
   # manager.bus.add_signal_receiver(self.attrs, ack=self.on_success, error=self.on_error)
   trigger = None
   try:
     trigger = Trigger(new_path, manager, props, self)
     if trigger:
       trigger.Armed( )
       self.manager.Trigger("Arming", trigger.path)
       self.trigger = trigger
       print "DELAYING", delay_ms
       gobject.timeout_add(delay_ms, trigger.Fire)
       manager.InterfacesAdded(trigger.path, { Trigger.OWN_IFACE: props })
       self.manager.Trigger("Armed", trigger.path)
   except:
     print "already exited?"
     raise
   finally:
     pass
   return trigger
Example #3
0
    def run(self):

        GObject.timeout_add(100, self._idle, priority=GObject.PRIORITY_HIGH)

        while True:
            Gtk.main_iteration()
            gevent.sleep(.001)
Example #4
0
    def _timer_transition_to_state(self, dest_state):
        cur_time = int(time.time())

        if dest_state == Timer.STATE_IDLE:
            self._end_time = 0
            self._set_remaining_time(self._duration_seconds)
        elif dest_state == Timer.STATE_RUNNING:
            assert self._duration_seconds >= 0

            if self._state == Timer.STATE_IDLE:
                self._end_time = cur_time + self._duration_seconds
                self._set_remaining_time(self._duration_seconds)
            elif self._state == Timer.STATE_PAUSED:
                self._end_time = cur_time + self._remaining_seconds

            GObject.timeout_add(500, self._on_timeout)
        elif dest_state == Timer.STATE_PAUSED:
            self._set_remaining_time(self._end_time - cur_time)
            self._end_time = 0
        elif dest_state == Timer.STATE_FINISHED:
            pass
        else:
            assert False

        self._timer_set_state(dest_state)
Example #5
0
 def add_log_message(self, client_program_name, q_domain, domain_filter,
                     action):
     """Add log message to the logs window"""
     self._logs_window.add_log_line(client_program_name, q_domain,
                                    domain_filter, action)
     color = ACTION_COLOR_MAP.get(action, ACTION_COLOR_MAP['default'])
     GObject.timeout_add(1000, self.set_blinker, color)
Example #6
0
 def run(self, argv):
     GObject.threads_init()
     GObject.timeout_add(10, self.on_timer)
     self.connect("startup", self.on_startup)
     self.connect("activate", self.on_activate)
     self.connect("shutdown", self.on_shutdown)
     return super(Gtk3Example, self).run(argv)
 def test_searchentry(self):
     from softwarecenter.ui.gtk3.widgets.searchentry import get_test_searchentry_window
     win = get_test_searchentry_window()
     s = "foo"
     win.entry.insert_text(s, len(s))
     GObject.timeout_add(TIMEOUT, lambda: win.destroy())
     Gtk.main()
Example #8
0
    def go_to_bookmark(self, subfilenumber, identifier):
        if self._sub_file_number != subfilenumber:
            self.__load_file(subfilenumber, timeout=100)

        GObject.timeout_add(100,
                            self.__scroll_to_bookmark_position_in_file,
                            identifier)
Example #9
0
    def calculateDiffs(self, menuItem, showNotification=True):
        self.setMenuEnabled(False)
        self.packageTitle.set_label('Calculating file diffs...')
        while Gtk.events_pending():
            Gtk.main_iteration()
        selected = self.getSelectedPackages()

        totalDiff = 0

        for package in selected:
            diff = self.bkup.getFileSizeDiff(package)
            totalDiff += diff
            print(self.bkup.humanPrint(diff))
            humanDiff = self.bkup.humanPrint(diff)
            newLabel = package + ' (' + humanDiff + ' change)'
            print(self.packages[package].set_label(newLabel))

        self.setMenuEnabled(True)
        self.packageTitle.set_label('Packages from bkup.yaml:')
        self.removeDiffLabelTime = time.time() + 60 * 5
        GObject.timeout_add(60 * 1000, self.checkDiffLabelRemovalTime)

        if showNotification:
            msg = Notify.Notification.new('Calculated file diffs', 'Bkup')
            msg.show()

        return totalDiff
Example #10
0
  def _iterAction(self):
    '''
    Iterate to the next sequence step.
    '''
    if len(self.steps) <= self._current_step:
      if self._loop is not None:
        self._loop.quit()
      return
    action = self.steps[self._current_step]
    if self._verbose:
      print _('SEQUENCE: %s') % action

    try:
      next_action = self.steps[self._current_step + 1]
    except IndexError:
      next_action = None

    pyatspi.Registry.deregisterEventListener(self._onAnticipatedEvent,
                                             *self._anticipated_event_types)
    if isinstance(next_action, WaitAction):
      self._anticipated_event_types = next_action.wait_for
    else:
      self._anticipated_event_types = []
    pyatspi.Registry.registerEventListener(self._onAnticipatedEvent,
                                           *self._anticipated_event_types)
    self._current_handler = action.connect('done', self._onStepDone)

    GObject.timeout_add(action.delta_time, self._doAction, action)
Example #11
0
 def __load_previous_file(self, scroll_to_end=True):
     if self._sub_file_number > 0:
         self.__load_file(self._sub_file_number - 1)
         if scroll_to_end is True:
             GObject.timeout_add(100, self.__scroll_to_end_of_loaded_file)
         else:
             self._previous_file_loaded = True
Example #12
0
    def removeTheme(self):
        self.threadAction = _("remove")
        self.threadPackage = self.plymouth.getRemovablePackageName(self.selectedRemoveTheme)
        if self.threadPackage:
            dialog = QuestionDialog(_("Remove theme"), _("Continue removing theme:\n%(theme)s") % { "theme": self.threadPackage }, self.window)
            go = dialog.show()
            if (go):
                self.toggleGuiElements(True)

                # Start apt in a separate thread
                self.log.write(_("Start removing theme: %(theme)s") % { "theme": self.threadPackage }, 'dpm.removeTheme', 'info')
                cmd = 'apt-get purge -y %s %s' % (self.force, self.threadPackage)
                t = ExecuteApt(self.log, cmd, self.queue)
                t.daemon = True
                t.start()
                self.queue.join()

                #self.log.write("Check every 250 miliseconds if thread is still active", 'dpm.removeTheme')
                GObject.timeout_add(250, self.checkAptThread)
            else:
                self.log.write(_("User cancel remove theme: %(theme)s") % { "theme": self.threadPackage }, 'dpm.removeTheme', 'info')
        else:
            title = _("%(act1)s%(act2)s theme") % { "act1": self.threadAction[0].capitalize(), "act2": self.threadAction[1:] }
            msg = _("The package cannot be removed: %(pck)s\nIt is part of a meta package.\nTry apt instead") % { "pck": self.selectedRemoveTheme }
            self.log.write(msg, 'dpm.removeTheme')
            MessageDialogSafe(title, msg, Gtk.MessageType.INFO, self.window).show()
Example #13
0
 def setGrubResolution(self):
     self.toggleGuiElements(True)
     self.log.write(_("Save grub resolution: %(res)s") % { "res": self.selectedGrubResolution }, 'dpm.setGrubResolution', 'info')
     # Start saving in a separate thread
     t = GrubSave(self.log, self.selectedGrubResolution)
     t.start()
     GObject.timeout_add(250, self.checkGrubThread)
 def __init__(self, location):
     self.location = location
     self.view_iter = None
     self.drawing = DigitalClockDawing(location)
     self.list_store = None
     GObject.timeout_add(1000, self.update)
     print "DIGI"
    def _save_selected_subtitle (self):
        cursor = Gdk.Cursor.new (Gdk.CursorType.WATCH)
        self._dialog.get_window ().set_cursor (cursor)

        model, rows = self._tree_view.get_selection ().get_selected_rows ()
        if rows:
            subtitle_iter = model.get_iter (rows[0])
            subtitle_id = model.get_value (subtitle_iter, 3)
            subtitle_format = model.get_value (subtitle_iter, 1)

            bpath = self._cache_subtitles_dir()

            directory = Gio.file_new_for_path (bpath)
            try:
                directory.make_directory_with_parents (None);
            except:
                pass

            thread = DownloadThread (self._model, subtitle_id)
            thread.start ()
            GObject.idle_add (self._save_subtitles, thread, subtitle_format)

            self._progress.set_text (_(u'Downloading the subtitles…'))
            GObject.timeout_add (350, self._progress_bar_increment, thread)
        else:
            #warn user!
            pass
    def __init__(self, *p):
        Gtk.Grid.__init__(self,margin=5,column_spacing=5,row_spacing=5)

        self._vlc_widget = VLCWidget(*p)
        self._vlc_widget.props.hexpand = True
        self._vlc_widget.props.vexpand = True
        self.player = self._vlc_widget.player
        self.attach(self._vlc_widget,0,0,5,1)

        for i,(stock, func) in enumerate((
            (Gtk.STOCK_MEDIA_PLAY, self.player.play),
            (Gtk.STOCK_MEDIA_PAUSE, self.player.pause),
            (Gtk.STOCK_MEDIA_NEXT, self.player.next_frame),
            (Gtk.STOCK_MEDIA_STOP, self.player.stop),
            )):
            b = Gtk.Button(stock=stock)
            b.connect("clicked", self._on_click_player_command, func)
            b.props.hexpand = False
            b.props.halign = Gtk.Align.START
            self.attach(b,i,1,1,1)

        self._scale = Gtk.Scale.new_with_range(Gtk.Orientation.HORIZONTAL,0,1,0.01)
        self._scale.props.hexpand = True
        self._scale.props.draw_value = False
        self._scale_changing_by_us = False
        self._scale.connect("value-changed", self._slider_changed)
        self.attach(self._scale,i+1,1,1,1)

        self._lbl = Gtk.Label("")
        self._lbl.props.hexpand = True
        self._lbl.props.halign = Gtk.Align.END
        self._lbl.props.xalign = 1.0
        self.attach(self._lbl,1,2,4,1)

        GObject.timeout_add(50,self._update_slider)
Example #17
0
    def run(self, debug=None):
        """
        Run the main loop.
        """
        GObject.timeout_add(50, self.select_setup)
        # self.select_setup()

        # GObject.timeout_add(500, callback)
        # loop = GLib.MainLoop()
        # loop.run()
        # return

        if debug is not None:
            self.debug_shell_gtk(debug)
        else:
            from gi.repository import Gtk

            # workaround for https://bugzilla.gnome.org/show_bug.cgi?id=622084
            import signal

            signal.signal(signal.SIGINT, signal.SIG_DFL)
            # end workaround
            logger.debug("Entering main loop")
            # main_loop = GLib.MainLoop()
            # main_loop.run()
            Gtk.main()
Example #18
0
 def play(self, sender):
     if sender.get_active():
         self.pipeline.set_file(self.filedialog.get_uri())
         self.pipeline.play()
         GObject.timeout_add(100, self.update_position)
     else:
         self.pipeline.pause()
Example #19
0
    def __init__(self):
        Gtk.Window.__init__(self, title="SwDiag")
        self.set_border_width(10)
        self.set_default_size(600, 800)

        self.rake = HayRotaryRake()
        self.degrees_of_freedom = []
        self.outputs = {}
        self.inputs = {}

        self.box = Gtk.Box(spacing=6)
        self.add(self.box)

        self.drawing_area = Gtk.DrawingArea()
        self.drawing_area.set_size_request(800, 400)
        self.drawing_area.connect('draw', drawSimulation, self.inputs)

        try:
            self.conn = Connector("/dev/ttyACM{i}", 9600)
            self.conn.register_input_observer(self)
            self.conn.register_log_observer(self)
            self.conn.register_output_observer(self)

            integer_id = GObject.timeout_add(50, self.read)

            GObject.timeout_add(10000, self.activate)
        except Exception as e:
            print(e)

        #self.set_geometry_hints(self.scroll_txt_log,-1,-1)
        self.show_all()
Example #20
0
 def focusOut(self, widegt, event, data=None):
     ## called 0.0004 sec (max) after focusIn (if switched between two windows)
     dt = now()-ui.focusTime
     #print('focusOut', dt)
     if dt > 0.05: ## FIXME
         self.focus = False
         gobject.timeout_add(2, self.focusOutDo)
Example #21
0
def closeTab(act, save = True):
    if save and act.vigtk.window.get_active_document().get_modified():
        act.menus["fileClose"].activate()
    else:
        act.vigtk.window.close_tab(act.vigtk.window.get_active_tab())
        
    gobject.timeout_add(100, waitUntilDialogDone, act)
Example #22
0
 def _init_activated(self, btn, model, path):
     obj = model[path][self.COL_ROW_DATA]
     s = Gtk.Settings.get_default()
     GObject.timeout_add(
         s.get_property("gtk-timeout-initial"),
         self._activated_callback,
         btn, btn.name, obj, model, path)
Example #23
0
    def add_notification(self, icon, corner=Gtk.CornerType.TOP_LEFT,
                         duration=_NOTIFICATION_DURATION):

        if not isinstance(icon, NotificationIcon):
            raise TypeError('icon must be a NotificationIcon.')

        window = NotificationWindow()

        screen = Gdk.Screen.get_default()
        if corner == Gtk.CornerType.TOP_LEFT:
            window.move(0, 0)
        elif corner == Gtk.CornerType.TOP_RIGHT:
            window.move(screen.get_width() - style.GRID_CELL_SIZE, 0)
        elif corner == Gtk.CornerType.BOTTOM_LEFT:
            window.move(0, screen.get_height() - style.GRID_CELL_SIZE)
        elif corner == Gtk.CornerType.BOTTOM_RIGHT:
            window.move(screen.get_width() - style.GRID_CELL_SIZE,
                        screen.get_height() - style.GRID_CELL_SIZE)
        else:
            raise ValueError('Inalid corner: %r' % corner)

        window.add(icon)
        icon.show()
        window.show()

        self._notif_by_icon[icon] = window

        GObject.timeout_add(duration,
                            lambda: self.remove_notification(icon))
  def _addChild(self, iter, parent):
    '''
    Add the new child to the given accessible.

    @param iter: Th iter of the row that needs a child added. 
    @type iter: L{gtk.TreeIter}
    @param parent: The given row's accessible.
    @type parent: L{Accessibility.Accessible}
    '''
    old_children = self.model.getChildrenAccs(iter)
    new_children = list(parent) 
    if self.model.getHideLeaves():
      # time for new child load its children (if it has any),
      # so it won't be confused with a leaf
      sleep(ACCESSIBLE_LOADING)
      new_children = self.removeLeaves(new_children)

    old_children = set(old_children)
    new_children = set(new_children)

    added = new_children.difference(old_children)
    try:
      new_child = added.pop()
    except KeyError:
      return
    row = self.model._buildRow(new_child)
    if new_child is None:
      self.model.append(iter, row)
    else:
      self.model.insert(iter, self.model.getIndexInParent(new_child), row)
      # We do this because an application won't have an icon loaded in 
      # the window manager when it is first registered to at-spi
      if new_child == new_child.getApplication():
        GObject.timeout_add(1000, self._refreshIcon, new_child)
    def showGUI(self):
        """Show the splash screen dialog."""

        imageFile = os.path.join(orca_platform.prefix,
                    orca_platform.datadirname,
                    orca_platform.package,
                    "gfx",
                    "orca-splash.png")

        image = Gtk.Image()
        image.set_from_file(imageFile)

        self.add(image)

        try:
            self.realize()
        except:
            debug.printException(debug.LEVEL_FINEST)

        self.set_transient_for(None)
        self.grab_focus()
        self.show_all()

        GObject.timeout_add(3000, self.hideGUI)

        while Gtk.events_pending():
            Gtk.main_iteration()

        return self
Example #26
0
    def on_category_clicked(self, btn, cat):
        """emit the category-selected signal when a category was clicked"""
        def timeout_emit():
            self.emit("category-selected", cat)
            return False

        GObject.timeout_add(50, timeout_emit)
Example #27
0
    def __init__(self):

        cream.Module.__init__(self, 'org.cream.Chronos')

        self.events = {}
        self.calendars = ordereddict()
        self.colors = find_colors(.57, .72, .79)

        self.calendar = cream.ipc.get_object('org.cream.PIM', '/org/cream/PIM/Calendar')
        self.calendar.search_for_calendars()

        self.calendar.connect_to_signal('calendar_added', self.add_calendar)
        self.calendar.connect_to_signal('event_added', lambda u,e: self.add_events([e]))
        self.calendar.connect_to_signal('event_removed', lambda u,e: self.remove_events([e]))
        self.calendar.connect_to_signal('event_updated', lambda u,e: self.update_events([e]))

        self.calendar_ui = CalendarUI()

        self.calendar_ui.window.connect('delete_event', lambda *x: self.quit())
        self.calendar_ui.connect('calendar-state-changed', self.calendar_state_change_cb)


        for calendar in self.calendar.get_calendars():
            self.add_calendar(calendar['uid'], calendar)

        def add_events():
            events = self.calendar.query({})
            self.add_events(events)
        gobject.timeout_add(1, add_events)
Example #28
0
    def __init__(self, callback=None):
        self.on_receive_callback = callback
        self._type = "rabbitmq"
        MM = 'majormajor'
        # connect to the global channels where messages are broadcasted
        writes = random.sample(xrange(4), 2)
        reads = [x for x in xrange(4) if not x in writes]
        self.global_write_queues = [MM + str(x) for x in writes]
        self.global_read_queues = [MM + str(x) for x in reads]
        connection = pika.BlockingConnection(
            pika.ConnectionParameters('localhost'))
        channel = connection.channel()
        for x in xrange(4):
            q = MM + str(x)
            channel.queue_declare(queue=q)

        # set up a new queue where people can message this person directly.
        self.read_queue = False
        i = 0
        while self.read_queue is False:
            queue_name = MM + str(i)
            try:
                connection = pika.BlockingConnection(
                    pika.ConnectionParameters('localhost'))
                channel = connection.channel()
                channel.queue_declare(queue=queue_name, passive=True)
            except:
                connection = pika.BlockingConnection(
                    pika.ConnectionParameters('localhost'))
                self.channel = connection.channel()
                self.channel.queue_declare(queue=queue_name)
                self.read_queue = queue_name
            i += 1
        self.all_read_queues = [self.read_queue] + self.global_read_queues[:]
        GObject.timeout_add(100, self._check_for_messages)
  def _addChild(self, iter, parent):
    '''
    Add the new child to the given accessible.

    @param iter: Th iter of the row that needs a child added. 
    @type iter: L{gtk.TreeIter}
    @param parent: The given row's accessible.
    @type parent: L{Accessibility.Accessible}
    '''
    old_children = set(self.model.getChildrenAccs(iter))
    new_children = set(list(parent))
    added = new_children.difference(old_children)
    try:
      new_child = added.pop()
    except KeyError:
      return
    row = self.model._buildRow(new_child)
    if new_child is None:
      self.model.append(iter, row)
    else:
      self.model.insert(iter, new_child.getIndexInParent(), row)
      # We do this because an application won't have an icon loaded in 
      # the window manager when it is first registered to at-spi
      if new_child == new_child.getApplication():
        GObject.timeout_add(1000, self._refreshIcon, new_child)
Example #30
0
def _button_release_cb(win, event, sw):
    if sw.press == None:
        return True
    for i in range (0,4):
        if sw.press == sw.buttons_off[i].spr:
            sw.buttons_on[i].draw_sprite(1500)
            GObject.idle_add(__play_sound_cb, sw.sound_files[i], sw.sound)
            GObject.timeout_add(500,sw.buttons_on[i].spr.hide)
            if sw.playpushed is False:
                sw.press = None
                return
            if sw.seq[sw.counter] == i: # correct reponse
                sw.counter += 1
                if sw.counter == sw.level*2:
                    GObject.timeout_add(1000, _dance, sw, [i], 10, 0)
                    sw.counter = 0
                    sw.level += 1
                    sw.activity.level_label.set_text(
                        "%s %d" % (_("Level"),sw.level))
                    if sw.level*2 < len(sw.seq):
                        GObject.timeout_add(3000, play_the_game, sw)
                    else: # game over
                        GObject.timeout_add(2000, _flash, sw, 7, True)
                        sw.playpushed = False
                        sw.level = 1
                        sw.seq = gen_seq(30)
                        sw.activity.level_label.set_text(
                            "%s %d" % (_("Level"),sw.level))
            else: # incorrect response
                _all_gone(sw)
                GObject.timeout_add(1000, _all_off, sw)
                sw.counter = 0
    sw.press = None
Example #31
0
 def icon_bell(self):
     """A bell signal requires we display our bell icon"""
     self.bellicon.show()
     GObject.timeout_add(1000, self.icon_bell_hide)
Example #32
0
        #prid = src.add_probe(Gst.PadProbeType.BLOCK, block, None)
        queue.unlink(preview)
        scale.set_state(Gst.State.PLAYING)
        queue.link(scale)
        scale.link_filtered(preview, preview_caps)
        #src.remove_probe(prid)
        self.pipeline.set_state(Gst.State.PLAYING)

    def pmsg(self, msg_bus, msg):
        if msg.type == Gst.MessageType.ERROR or msg.type == Gst.MessageType.EOS:
            ml.quit()
        if msg.type == Gst.MessageType.STATE_CHANGED:
            #print pipeline.get_state(Gst.CLOCK_TIME_NONE).state
            self.stats(msg_bus)


c1 = Capture()
c2 = Capture()

GObject.timeout_add(1000, c1.addPreview)
GObject.timeout_add(1000, c2.addPreview)

GObject.timeout_add(2000, c1.addScaler)

try:
    ml.run()
finally:
    # Free resources when mainloop terminates
    c1.pipeline.set_state(Gst.State.NULL)
    c2.pipeline.set_state(Gst.State.NULL)
Example #33
0
File: game.py Project: cemeiq/flip
 def solve(self):
     ''' Solve the puzzle by undoing moves '''
     if self._move_list == []:
         return
     self._flip_them(self._move_list.pop(), append=False)
     GObject.timeout_add(750, self.solve)
Example #34
0
 def on_entry_changed(self, widget):
     if self._value_changed_timer:
         GObject.source_remove(self._value_changed_timer)
     self._value_changed_timer = GObject.timeout_add(
         300, self.update_from_entry)
Example #35
0
 def resume_monitor(self):
     if self.resume_timeout:
         GObject.source_remove(self.resume_timeout)
     self.resume_timeout = GObject.timeout_add(2000, self.do_resume)
Example #36
0
 def on_file_changed(self, file, other, event, data):
     if self.file_changed_timeout:
         GObject.source_remove(self.file_changed_timeout)
     self.file_changed_timeout = GObject.timeout_add(300, self.do_reload)
Example #37
0
 def on_my_value_changed(self, widget):
     if self._value_changed_timer:
         GObject.source_remove(self._value_changed_timer)
     self._value_changed_timer = GObject.timeout_add(
         300, self.update_settings_value)
Example #38
0
    def install_ffmpeg(self):
        """Called by self.run().

        A modified version of self.install_ytdl, that installs FFmpeg on an
        MS Windows system.

        Creates a child process to run the installation process.

        Reads from the child process STDOUT and STDERR, and calls the main
        application with the result of the update (success or failure).
        """

        # Show information about the update operation in the Output Tab
        self.app_obj.main_win_obj.output_tab_write_stdout(
            1,
            _('Starting update operation, installing FFmpeg'),
        )

        # Create a new child process to install either the 64-bit or 32-bit
        #   version of FFmpeg, as appropriate
        if sys.maxsize <= 2147483647:
            binary = 'mingw-w64-i686-ffmpeg'
        else:
            binary = 'mingw-w64-x86_64-ffmpeg'

        self.create_child_process(['pacman', '-S', binary, '--noconfirm'], )

        # Show the system command in the Output Tab
        space = ' '
        self.app_obj.main_win_obj.output_tab_write_system_cmd(
            1,
            space.join(['pacman', '-S', binary, '--noconfirm']),
        )

        # So that we can read from the child process STDOUT and STDERR, attach
        #   a file descriptor to the PipeReader objects
        if self.child_process is not None:

            self.stdout_reader.attach_file_descriptor(
                self.child_process.stdout, )

            self.stderr_reader.attach_file_descriptor(
                self.child_process.stderr, )

        while self.is_child_process_alive():

            # Read from the child process STDOUT, and convert into unicode for
            #   Python's convenience
            while not self.stdout_queue.empty():

                stdout = self.stdout_queue.get_nowait().rstrip()
                stdout = stdout.decode('cp1252')

                if stdout:

                    # Show command line output in the Output Tab
                    self.app_obj.main_win_obj.output_tab_write_stdout(
                        1,
                        stdout,
                    )

        # The child process has finished
        while not self.stderr_queue.empty():

            # Read from the child process STDERR queue (we don't need to read
            #   it in real time), and convert into unicode for python's
            #   convenience
            stderr = self.stderr_queue.get_nowait().rstrip()
            stderr = stderr.decode('cp1252')

            # Ignore pacman warning messages, e.g. 'warning: dependency cycle
            #   detected:'
            if stderr and not re.match('warning\:', stderr):

                self.stderr_list.append(stderr)

                # Show command line output in the Output Tab
                self.app_obj.main_win_obj.output_tab_write_stdout(
                    1,
                    stderr,
                )

        # (Generate our own error messages for debugging purposes, in certain
        #   situations)
        if self.child_process is None:
            self.stderr_list.append(_('FFmpeg installation did not start'))

        elif self.child_process.returncode > 0:
            self.stderr_list.append(
                _('Child process exited with non-zero code: {}').format(
                    self.child_process.returncode, ))

        # Operation complete. self.success_flag is checked by
        #   mainapp.TartubeApp.update_manager_finished
        if not self.stderr_list:
            self.success_flag = True

        # Show a confirmation in the the Output Tab
        self.app_obj.main_win_obj.output_tab_write_stdout(
            1,
            _('Update operation finished'),
        )

        # Let the timer run for a few more seconds to prevent Gtk errors (for
        #   systems with Gtk < 3.24)
        GObject.timeout_add(
            0,
            self.app_obj.update_manager_halt_timer,
        )
Example #39
0
    def activateCb(self, app):
        #Global Variables (keep to a minimum)
        self.settings = settings.IconoSettings(sopranoGlobals.SETTINGS_DATA)
        self.taglookup = TrackMetaData()
        self.seekingnow = False
        #load settings
        self.currentview, self.winwidth, self.winheight, self.defaultexplorer, self.shuffle, self.repeat, self.showtrayicon, self.closetotray = self.settings.get_settings(
        )

        libraryFolderlist = settings.IconoPrefs(sopranoGlobals.LIBRARY_DATA)
        self.SopranoDB = MusicDB(
            os.path.join(sopranoGlobals.CONFIGDIR, 'sopranoDB.db'))
        libraryFolderlist.add_radio(
            ('/media/Media/Music', '/media/Media/Music'))
        for key, value in libraryFolderlist.get_radioStations().items():
            self.SopranoDB.add_folder(value)

        #turn on the dbus mainloop for sound menu
        from dbus.mainloop.glib import DBusGMainLoop
        DBusGMainLoop(set_as_default=True)
        #Start Sound Menu Support
        self.sopranompris = SoundMenuControls("soprano-player")
        self.sopranompris.signal_next = self.play_next
        self.sopranompris.signal_prev = self.play_prev
        self.sopranompris.signal_play_pause = self.play_pause
        self.sopranompris.signal_raise = self.toggle_window

        #Enable Notifications
        Notify.init("Soprano")
        self.notification = Notify.Notification.new("", "", "")

        #Window Creation
        self.builder = Gtk.Builder()
        filename = os.path.join('data', 'MainWindow.glade')
        self.builder.add_from_file(filename)
        self.builder.connect_signals(self)

        self.window = self.builder.get_object('win-main')
        self.window.set_default_size(self.winwidth, self.winheight)
        self.window.connect('delete-event', self.pre_exit)
        self.window.set_wmclass("Soprano Player", "Soprano Player")
        app.add_window(self.window)

        hb = self.builder.get_object('header-bar')
        self.window.set_titlebar(hb)

        #radiowindow
        self.aRadio = IconoRadio()

        #Gstreamer sink
        self.player = MusicPlayer()
        self.player.on_eos(self.on_message)
        #media keys setup
        self.mediakeys = mediakeys(self.play_prev, self.play_pause,
                                   self.play_next)

        timer = GObject.timeout_add(500, self.update_time_items)

        #trayicon
        self.tray = IconoTray("soprano-player-tray")
        self.trayshowhide = self.tray.add_menu_item(self.toggle_window,
                                                    "Hide/Show")
        self.tray.add_seperator()
        self.trayplaypause = self.tray.add_menu_item(self.play_pause,
                                                     "Play/Pause")
        self.tray.add_menu_item(self.play_next, "Next")
        self.tray.add_menu_item(self.play_prev, "Previous")
        self.tray.add_seperator()
        self.tray.add_menu_item(self.on_exit, "Quit")
        self.update_tray_icon(self.showtrayicon)

        # View Menu#
        #menuvfull = self.builder.get_object('menu-mode-full')
        #menuvfull.connect('activate', self.to_full_mode)
        #menuvmini = self.builder.get_object('menu-mode-mini')
        #menuvmini.connect('activate', self.to_mini_mode)
        #menuvplist = self.builder.get_object('menu-mode-playlist')
        #menuvplist.connect('activate', self.to_playlist_mode)

        # Quit, About Menus
        #menuaqt = self.builder.get_object('menu-quit')
        #menuaqt.connect('activate',self.on_exit)
        #menuabt = self.builder.get_object('menu-about')
        #menuabt.connect('activate', aboutBoxShow, self.window)

        #Edit Menu#
        #menuaddfolder = self.builder.get_object('menu-folderadd')
        #menuaddfolder.connect('activate', lambda x: self.addFolderExplorer(('Video','/media/Media/Videos')))
        #menuaddfolder.connect('activate', self.show_pref_win)

        #menuaddradio = self.builder.get_object('menu-radioadd')
        #menuaddradio.connect('activate', lambda x: self.delFolderExplorer(('Video','/media/Media/Videos')))
        #menuaddradio.connect('activate', self.aRadio.addStationDialog)

        #self.menuautopop = self.builder.get_object('menu-autopop')

        # Build the Gnome App Menu
        mainmenu = self.builder.get_object('app-menu')
        self.set_app_menu(mainmenu)

        prefs_action = Gio.SimpleAction.new("prefs", None)
        prefs_action.connect("activate", self.show_pref_win)
        self.add_action(prefs_action)

        radio_action = Gio.SimpleAction.new("radio", None)
        radio_action.connect("activate", self.aRadio.addStationDialog)
        self.add_action(radio_action)

        self.menuautopop = False
        autopop_action = Gio.SimpleAction.new("autopop", None)
        autopop_action.connect("activate", self.toggleAutoPop)
        self.add_action(autopop_action)

        view_full_action = Gio.SimpleAction.new("view-full", None)
        view_full_action.connect("activate", self.to_full_mode)
        self.add_action(view_full_action)

        view_playlist_action = Gio.SimpleAction.new("view-playlist", None)
        view_playlist_action.connect("activate", self.to_playlist_mode)
        self.add_action(view_playlist_action)

        view_mini_action = Gio.SimpleAction.new("view-mini", None)
        view_mini_action.connect("activate", self.to_mini_mode)
        self.add_action(view_mini_action)

        about_action = Gio.SimpleAction.new("about", None)
        about_action.connect("activate", aboutBoxShow, self.window)
        self.add_action(about_action)

        quit_action = Gio.SimpleAction.new("quit", None)
        quit_action.connect("activate", self.on_exit)
        self.add_action(quit_action)

        #playing Toolbar
        self.toolnext = self.builder.get_object('btn-next')
        self.toolnext.connect('clicked', self.play_next)

        self.toolprev = self.builder.get_object('btn-previous')
        self.toolprev.connect('clicked', self.play_prev)

        self.toolstop = self.builder.get_object('btn-stop')
        self.toolstop.connect('clicked', self.stop_play)

        self.toolplay = self.builder.get_object('btn-play')
        self.toolplay.connect('clicked', self.play_pause)

        self.toolSeekBar = self.builder.get_object('scl-position')
        self.toolSeekBar.connect('button-release-event', self.seek)
        self.toolSeekBar.connect('button-press-event', self.seekevent)

        self.toolVolume = self.builder.get_object('btn-volume')
        self.toolVolume.connect('value-changed', self.change_volume)

        #Text Displays
        self.titleText = self.builder.get_object('lbl-trkTitle')
        #self.titleText.connect('size-allocate', lambda label, size: label.set_size_request(size.width - 1, -1))
        self.infoText = self.builder.get_object('lbl-trkMisc')
        self.lengthLabel = self.builder.get_object('lbl-length')
        self.elapsedLabel = self.builder.get_object('lbl-elapsed')

        #bottom toolbar
        barclr = self.builder.get_object('btn-tracklistClear')
        barclr.connect('clicked', self.clear_liststore)

        barshfl = self.builder.get_object('btn-tracklistShuffle')
        if self.shuffle == True:
            barshfl.set_active(True)
        barshfl.connect('clicked', self.shuffleliststore)

        barrpt = self.builder.get_object('btn-tracklistRepeat')
        if self.repeat == True:
            barrpt.set_active(True)
        barrpt.connect('toggled', self.setrepeat)

        #listview
        self.iconoListView = IconoListView()
        self.iconoListView.get_sw().get_child().connect(
            'row-activated', self.on_activated)
        #self.iconoListView.get_sw().get_child().connect('button-press-event', self.on_right_click)
        vbox2 = self.builder.get_object('vbox2')
        vbox2.add(self.iconoListView.get_sw())
        vbox2.reorder_child(self.iconoListView.get_sw(), 1)
        if os.path.exists(sopranoGlobals.TREE_DATA):
            GObject.idle_add(self.iconoListView.load_shelf,
                             sopranoGlobals.TREE_DATA)

        #combobox
        self.hCombo = HeaderedComboBox()
        self.hCombo.connect("changed", self.on_name_combo_changed)

        self.builder.get_object('box-combo-explorer').add(self.hCombo)

        GObject.idle_add(self.setup_explorer)
        GObject.idle_add(self.cover_update)
        self.window.show_all()
        if self.currentview == 'playlist':
            menuvplist.set_active(True)
            self.to_playlist_mode()
        elif self.currentview == 'mini':
            menuvmini.set_active(True)
            self.to_mini_mode()
        #Notebook
        self.notebook = self.builder.get_object('notebook-explorer')
Example #40
0
    def install_ytdl(self):
        """Called by self.run().

        Based on code from downloads.VideoDownloader.do_download().

        Creates a child process to run the youtube-dl update.

        Reads from the child process STDOUT and STDERR, and calls the main
        application with the result of the update (success or failure).
        """

        # Show information about the update operation in the Output Tab
        downloader = self.app_obj.get_downloader()
        self.app_obj.main_win_obj.output_tab_write_stdout(
            1,
            _('Starting update operation, installing/updating ' + downloader),
        )

        # Prepare the system command

        # The user can change the system command for updating youtube-dl,
        #   depending on how it was installed
        # (For example, if youtube-dl was installed via pip, then it must be
        #   updated via pip)
        cmd_list \
        = self.app_obj.ytdl_update_dict[self.app_obj.ytdl_update_current]

        mod_list = []
        for arg in cmd_list:

            # Substitute in the fork, if one is specified
            arg = self.app_obj.check_downloader(arg)
            # Convert a path beginning with ~ (not on MS Windows)
            if os.name != 'nt':
                arg = re.sub('^\~', os.path.expanduser('~'), arg)

            mod_list.append(arg)

        # Create a new child process using that command
        self.create_child_process(mod_list)

        # Show the system command in the Output Tab
        space = ' '
        self.app_obj.main_win_obj.output_tab_write_system_cmd(
            1,
            space.join(mod_list),
        )

        # So that we can read from the child process STDOUT and STDERR, attach
        #   a file descriptor to the PipeReader objects
        if self.child_process is not None:

            self.stdout_reader.attach_file_descriptor(
                self.child_process.stdout, )

            self.stderr_reader.attach_file_descriptor(
                self.child_process.stderr, )

        while self.is_child_process_alive():

            # Read from the child process STDOUT, and convert into unicode for
            #   Python's convenience
            while not self.stdout_queue.empty():

                stdout = self.stdout_queue.get_nowait().rstrip()
                if stdout:

                    if os.name == 'nt':
                        stdout = stdout.decode('cp1252')
                    else:
                        stdout = stdout.decode('utf-8')

                    # "It looks like you installed youtube-dl with a package
                    #   manager, pip, setup.py or a tarball. Please use that to
                    #   update."
                    # "The script youtube-dl is installed in '...' which is not
                    #   on PATH. Consider adding this directory to PATH..."
                    if re.search('It looks like you installed', stdout) \
                    or re.search(
                        'The script ' + downloader + ' is installed',
                        stdout,
                    ):
                        self.stderr_list.append(stdout)

                    else:

                        # Try to intercept the new version number for
                        #   youtube-dl
                        self.intercept_version_from_stdout(stdout)
                        self.stdout_list.append(stdout)

                    # Show command line output in the Output Tab
                    self.app_obj.main_win_obj.output_tab_write_stdout(
                        1,
                        stdout,
                    )

        # The child process has finished
        while not self.stderr_queue.empty():

            # Read from the child process STDERR queue (we don't need to read
            #   it in real time), and convert into unicode for python's
            #   convenience
            stderr = self.stderr_queue.get_nowait().rstrip()
            if os.name == 'nt':
                stderr = stderr.decode('cp1252')
            else:
                stderr = stderr.decode('utf-8')

            if stderr:

                # If the user has pip installed, rather than pip3, they will by
                #   now (mid-2019) be seeing a Python 2.7 deprecation warning.
                #   Ignore that message, if received
                # If a newer version of pip is available, the user will see a
                #   'You should consider upgrading' warning. Ignore that too,
                #   if received
                if not re.search('DEPRECATION', stderr) \
                and not re.search('You are using pip version', stderr) \
                and not re.search('You should consider upgrading', stderr):
                    self.stderr_list.append(stderr)

                # Show command line output in the Output Tab
                self.app_obj.main_win_obj.output_tab_write_stdout(
                    1,
                    stderr,
                )

        # (Generate our own error messages for debugging purposes, in certain
        #   situations)
        if self.child_process is None:

            msg = _('Update did not start')
            self.stderr_list.append(msg)
            self.app_obj.main_win_obj.output_tab_write_stdout(
                1,
                msg,
            )

        elif self.child_process.returncode > 0:

            msg = _('Child process exited with non-zero code: {}').format(
                self.child_process.returncode, )
            self.app_obj.main_win_obj.output_tab_write_stdout(
                1,
                msg,
            )

        # Operation complete. self.success_flag is checked by
        #   mainapp.TartubeApp.update_manager_finished
        if not self.stderr_list:
            self.success_flag = True

        # Show a confirmation in the the Output Tab
        self.app_obj.main_win_obj.output_tab_write_stdout(
            1,
            _('Update operation finished'),
        )

        # Let the timer run for a few more seconds to prevent Gtk errors (for
        #   systems with Gtk < 3.24)
        GObject.timeout_add(
            0,
            self.app_obj.update_manager_halt_timer,
        )
Example #41
0
 def __init__(self, bus, index, service):
     Characteristic.__init__(self, bus, index, self.BATTERY_LVL_UUID,
                             ['read', 'notify'], service)
     self.notifying = False
     self.battery_lvl = 100
     GObject.timeout_add(5000, self.drain_battery)
Example #42
0
    thymio = Thymio()

    def avancer(vitesse, temps):
        thymio.setMotors(vitesse, vitesse)
        time.sleep(temps)

    def tournerAngle(angle):
        if angle <= 0:
            thymio.setMotors(300, -300)
            time.sleep(abs(angle) / 112)
        if angle > 0:
            thymio.setMotors(-300, 300)
            time.sleep(abs(angle) / 112)

    def avancerCourbe(vitessegauche, vitessedroite, temps):
        thymio.setMotors(vitessegauche, vitessedroite)
        time.sleep(temps)

    def arret():
        thymio.setMotors(0, 0)

    avancer(300, 2)
    tournerAngle(180)
    avancerCourbe(1000, 1000, 2)
    arret()

    loop = GObject.MainLoop()
    handle = GObject.timeout_add(1000, Braitenberg)
    loop.run()
 def mkdir(self, path):
     #This will "schedule" the internal function to be called later
     ret = GObject.timeout_add(0, self._mkdir, path)
     return ret >= 0
Example #44
0
 def set_timeout(self, timeout):
     GObject.timeout_add(timeout, self.stop)
Example #45
0
def delay_destroy_window(window, delay):
    GObject.timeout_add(int(delay * 1000), _window_destroy_event, window)
Example #46
0
 def _counter(self):
     ''' Display game_time as hours:minutes:seconds. '''
     self._game_time_seconds += 1
     self._game_time = convert_seconds_to_minutes(self._game_time_seconds)
     self._set_label(self._game_time)
     self._timeout_id = GObject.timeout_add(1000, self._counter)
 def after_show(*args):
     def f():
         self.move_to_monitor(self.options.monitor)
         self.prepare_next_data()
         self.next()
     GObject.timeout_add(200, f)
 def get_path_contents(self, path):
     #This will "schedule" the internal function to be called later
     ret = GObject.timeout_add(0, self._get_path_contents, path)
     return ret >= 0
Example #49
0
 def start(self):
     self.timeout_id = GObject.timeout_add(self.timeout_secs * 1000,
                                           self.handler, *self.args)
Example #50
0
 def __nick_changed_cb(self, widget, data=None):
     if self._nick_sid:
         GObject.source_remove(self._nick_sid)
     self._nick_sid = GObject.timeout_add(self._APPLY_TIMEOUT,
                                          self.__nick_timeout_cb, widget)
Example #51
0
    def handle_status(self, origin, status):
        """Activates or deactivates the buttons depending on the new status"""

        record = self.gui.get_object("recbutton")
        pause = self.gui.get_object("pausebutton")
        stop = self.gui.get_object("stopbutton")
        helpb = self.gui.get_object("helpbutton")
        editb = self.gui.get_object("editbutton")
        prevb = self.gui.get_object("previousbutton")
        swapb = self.gui.get_object("swapbutton")

        if status == INIT_STATUS:
            record.set_sensitive(False)
            pause.set_sensitive(False)
            stop.set_sensitive(False)
            helpb.set_sensitive(True)
            prevb.set_sensitive(True)
            editb.set_sensitive(False)
            swapb.set_sensitive(False)

        elif status == PREVIEW_STATUS:
            record.set_sensitive((self.allow_start or self.allow_manual))
            pause.set_sensitive(False)
            stop.set_sensitive(False)
            helpb.set_sensitive(True)
            prevb.set_sensitive(True)
            editb.set_sensitive(False)
            swapb.set_sensitive(True)

        elif status == RECORDING_STATUS:
            GObject.timeout_add(500, self.recording_info_timeout,
                                self.gui.get_object("recording1"),
                                self.gui.get_object("recording3"))

            record.set_sensitive(False)
            pause.set_sensitive(self.allow_pause
                                and self.recorder.is_pausable())
            stop.set_sensitive((self.allow_stop or self.allow_manual))
            helpb.set_sensitive(True)
            prevb.set_sensitive(False)
            swapb.set_sensitive(False)
            editb.set_sensitive((self.recorder.current_mediapackage
                                 and self.recorder.current_mediapackage.manual)
                                or False)

        elif status == PAUSED_STATUS:
            record.set_sensitive(False)
            pause.set_sensitive(False)
            stop.set_sensitive(False)
            prevb.set_sensitive(False)
            helpb.set_sensitive(False)
            editb.set_sensitive(False)

        elif status == ERROR_STATUS:
            record.set_sensitive(False)
            pause.set_sensitive(False)
            stop.set_sensitive(False)
            helpb.set_sensitive(True)
            prevb.set_sensitive(True)
            editb.set_sensitive(False)
            if self.focus_is_active:
                self.launch_error_message()

        if status == PAUSED_STATUS:
            GLib.idle_add(self.show_pause_dialog)
        else:
            if self.pause_dialog:
                GLib.idle_add(self.hide_pause_dialog)

        # Change status label
        if status in STATUSES:
            self.view.set_displayed_row(Gtk.TreePath(STATUSES.index(status)))
        else:
            logger.error(
                "Unable to change status label, unknown status {}".format(
                    status))
        # Close error dialog
        if status not in [ERROR_STATUS] and self.error_dialog:
            self.destroy_error_dialog()
Example #52
0
#!/usr/bin/python3

from gi.repository import GObject
import os
import spp_server


def my_read_cb(value):
    print('my callback: {}'.format(value))


def my_write_cb(my_server):
    cpu_temp = os.popen('vcgencmd measure_temp').readline()
    if my_server.fd_available():
        my_server.write_spp('{}'.format(
            float(cpu_temp.replace('temp=', '').replace("'C\n", ''))))
        print('Sending: {}'.format(
            float(cpu_temp.replace('temp=', '').replace("'C\n", ''))))
    return True


if __name__ == '__main__':
    my_spp_server = spp_server.SPP(my_read_cb)
    GObject.timeout_add(1000, my_write_cb, my_spp_server)
    my_spp_server.start()
Example #53
0
 def _timer_schedule(self):
     self._invalidate_current_timer()
     GObject.timeout_add(int(round(self._wait_seconds * 1000)),
                         self._timer_check_run, self._current_timer_id)
Example #54
0
    def __init__(self, package=None):
        logger.info("Creating Recording Area")
        Gtk.Box.__init__(self)

        builder = Gtk.Builder()
        builder.add_from_file(get_ui_path('recorder.glade'))
        release = builder.get_object("release_label")
        release.set_label(get_footer())

        # TEST
        self.repo = context.get_repository()
        self.dispatcher = context.get_dispatcher()
        self.worker = context.get_worker()
        self.conf = context.get_conf()
        self.recorder = context.get_recorder()
        self.recorder.set_create_drawing_areas_func(self.create_drawing_areas)
        self.start_recording = False
        self.font = None
        self.scheduled_recording = False
        self.focus_is_active = False
        self.net_activity = None
        self.error_dialog = None
        self.close_before_response_action = False

        # BUILD
        self.recorderui = builder.get_object("recorderbox")
        self.main_area = builder.get_object("videobox")
        self.vubox = builder.get_object("vubox")
        self.gui = builder

        # VUMETER
        self.rangeVum = 50
        self.thresholdVum = self.conf.get_float('audio', 'min')
        self.mute = False
        self.stereo = True
        self.vumeterL = builder.get_object("progressbarL")
        self.vumeterR = builder.get_object("progressbarR")
        self.label_channels = builder.get_object("label_channels")
        self.low_audio = False
        self.lowaudio_threshold = self.conf.get_float('lowaudio',
                                                      'lowaudio_threshold')

        # SWAP
        if not self.conf.get_boolean('basic', 'swapvideos'):
            self.gui.get_object("swapbutton").destroy()
        self.swap = False

        # STATUS
        self.view = self.set_status_view()
        hbox1 = self.gui.get_object('hbox1')
        hbox1.add(self.view)
        self.dispatcher.connect_ui("init", self.check_status_area)
        self.dispatcher.connect_ui("init", self.check_net, None)
        self.dispatcher.connect_ui("opencast-status", self.check_net)

        # UI
        self.pack_start(self.recorderui, True, True, 0)
        self.pause_dialog = None

        # Event Manager
        self.dispatcher.connect_ui("recorder-vumeter", self.set_vumeter)
        self.dispatcher.connect_ui("view-changed", self.event_change_mode)
        self.dispatcher.connect_ui("recorder-status", self.handle_status)
        self.dispatcher.connect_ui("recorder-ready", self.reset_mute)

        # STATES
        self.previous = None

        # PERMISSIONS
        self.allow_pause = self.conf.get_permission("pause")
        self.allow_start = self.conf.get_permission("start")
        self.allow_stop = self.conf.get_permission("stop")
        self.allow_manual = self.conf.get_permission("manual")
        self.allow_overlap = self.conf.get_permission("overlap")

        self.help_main_str = self.conf.get('help', 'main')
        self.help_text_str = self.conf.get('help', 'text')

        # OTHER
        builder.connect_signals(self)
        self.net_activity = self.conf.get_boolean('ingest', 'active')
        self.pausedialog_size = self.conf.get_int('basic',
                                                  'pausedialog_size',
                                                  default=15)
        if self.pausedialog_size < 5:
            self.pausedialog_size = 5
        elif self.pausedialog_size > 100:
            self.pausedialog_size = 100

        self.proportion = 1

        #TIMEOUTS
        deps = self.update_scheduler_deps()
        GObject.timeout_add(500, self.update_scheduler_timeout, *deps)
        self.update_clock_timeout(self.gui.get_object("local_clock"))
        GObject.timeout_add(10000, self.update_clock_timeout,
                            self.gui.get_object("local_clock"))
Example #55
0
    def grab_focus(self):
        def cb(*args):
            self.embed.grab_focus()

        GObject.timeout_add(10, cb)
Example #56
0
 def _find_cb(self, widget, data):
     # This loop makes sure that we only call _find every 500 ms .
     if self.timer_id:
         # We destroy the last event source and create another one.
         GObject.source_remove(self.timer_id)
     self.timer_id = GObject.timeout_add(500, self._find, widget, data)
Example #57
0
 def message(self, msg, timeout=1500):
     self.stop()
     self.set_label(msg)
     self.set_cancellable(False)
     GObject.timeout_add(timeout, self.finalize)
Example #58
0
 def _check_for_notifications(self):
     print 'Checking Settings notifications'
     if not self.notifying:
         return
     GObject.timeout_add(1000, self.notify_handset)
Example #59
0
 def blink(self):
     GObject.timeout_add(75, self.on_blink_tick)
Example #60
0
    def start_progress_pulse(self):
        if self.pulse_timer > 0:
            return

        self.progress.pulse()
        self.pulse_timer = GObject.timeout_add(1050, self.progress_pulse_tick)