Beispiel #1
0
 def executeAction(self, widget, event, app):
     if event.button == 1: # left click
         command = app.Exec.split('%')[0]
         if app.Terminal:
             command = '%s -e %s' % (self.settings['terminal'], command)
         Core.launch_command(command)
         self.toggle()
Beispiel #2
0
    def go(self, widget):
        url = " '" + self.plugin.settings['engine'] + self.entry.get_text() + "'"
        cmd = self.plugin.settings['browser'] + url
        Core.launch_command(cmd)

        self.entry.x_done = True
        self.entry.set_text("")
        self.toggle()
Beispiel #3
0
    def go(self, widget):
        url = " '" + self.plugin.settings['engine'] + self.entry.get_text(
        ) + "'"
        cmd = self.plugin.settings['browser'] + url
        Core.launch_command(cmd)

        self.entry.x_done = True
        self.entry.set_text("")
        self.toggle()
 def run(self, cmd, with_term):
     assert type(cmd) == str
     if len(cmd) > 0 and cmd[0] == '!':
         try:
             cmd, argv = cmd[1:].split(' ', 1)
         except:
             cmd = cmd[1:]
             argv = None
         if cmd in self.cmds:
             self.cmds[cmd](argv)
         else:
             Core.logINFO('Command "{0}" not implemented.'.format(cmd))
     else:
         if with_term:
             cmd = 'x-terminal-emulator -e {0}'.format(cmd)
         Core.launch_command(cmd)
Beispiel #5
0
    def update_time(self):

        options = Option(self.settings['servername'],self.settings['folder'],self.settings['username'],self.settings['password'],int(self.settings['connectiontimeout']),int(self.settings['mailinfo']))

        emailinfo = EmailInfo(options)
        mail=emailinfo.writeOutput()

        if mail == None:
            icon = 'mail-mark-important'
            self.can_show_icon = True
            self.set_size_request(self.cfg['icon_size'], self.cfg['icon_size'])
            if self.cfg['tooltips']:
              self.gmail.plugin.tooltip = _('Error loading mail')
        elif mail == {}:
            icon = 'mail-read'
            if self.settings['hide_icon'] == 0:
              self.can_show_icon = True
              self.set_size_request(self.cfg['icon_size'], self.cfg['icon_size'])
            else:
              self.can_show_icon = False
              self.set_size_request(-1, -1)

            if self.cfg['tooltips']:
              self.gmail.plugin.tooltip = _('No unread mail')
        else:
            #icon = 'stock_mail-unread'
            #icon = 'mail-mark-unread'
            icon = 'mail-unread'
            self.can_show_icon = True
            self.set_size_request(self.cfg['icon_size'], self.cfg['icon_size'])
            if self.cfg['tooltips']:
              self.gmail.plugin.tooltip = _('Unread mail : ')+str(len(mail))
            if int(self.settings['play_sound']) == 1:
              if self.settings['file_sound'] != '':
                              if Core.isfile('/usr/bin/mplayer') | \
                                 Core.isfile('/usr/local/bin/mplayer'):
                                    Core.launch_command('mplayer -quiet "'+self.settings['file_sound']+'"&')

        self.gmail.update_icon_status(icon)
        self.gmail.restart()
        return True
Beispiel #6
0
    def update_time(self):
        if self.locked:
            return True

        now = time.localtime()
        time_current = time.strftime(
            '<span color="%s">%s</span>' %
            (self.settings['time_color'], self.settings['time']), now)
        if self.lb_date:
            date_current = time.strftime(
                '<span color="%s">%s</span>' %
                (self.settings['date_color'], self.settings['date']), now)
        if not time_current == self.time_txt:
            self.lb_time.set_markup(time_current)
            self.time_txt = time_current
            if self.lb_date:
                self.lb_date.set_markup(date_current)
                self.date_txt = date_current
        if self.cfg['tooltips'] & (self.settings['tooltip'] != ''):
            self.calendarplugin.plugin.tooltip = time.strftime(
                self.settings['tooltip'], now)

        min_for_alarm_current = str(time.strftime('%M', now))
        if not min_for_alarm_current == self.min_for_alarm:
            self.min_for_alarm = min_for_alarm_current

            if self.alarmlist != []:
                plus5min = time.localtime(time.time() + 300)  #5 minutes *60
                for alarm in self.alarmlist:
                    if alarm != {}:
                        if   ( ( (alarm['date_d'] != '') & \
                                 (str(alarm['date_m']) == str(time.strftime('%m', now))) ) & \
                                 ((str(alarm['date_d']) == str(time.strftime('%d', now)) ) & \
                                  (str(alarm['date_y']) == str(time.strftime('%Y', now)) ) & \
                                  (str(alarm['time_h']) == str(time.strftime('%H', now)) ) & \
                                  (str(alarm['time_m']) == str(time.strftime('%M', now)) ) ) ) | \
                        \
                             ( ( (alarm['date_d'] == '') & \
                                 (str(alarm['time_m']) == str(time.strftime('%M', now)) ) & \
                                 (str(alarm['time_h']) == str(time.strftime('%H', now)) ) ) & \
                                   (( (str(time.strftime('%w', now)) == '1') & (str(alarm['day1']) == '1') ) | \
                                    ( (str(time.strftime('%w', now)) == '2') & (str(alarm['day2']) == '1') ) | \
                                    ( (str(time.strftime('%w', now)) == '3') & (str(alarm['day3']) == '1') ) | \
                                    ( (str(time.strftime('%w', now)) == '4') & (str(alarm['day4']) == '1') ) | \
                                    ( (str(time.strftime('%w', now)) == '5') & (str(alarm['day5']) == '1') ) | \
                                    ( (str(time.strftime('%w', now)) == '6') & (str(alarm['day6']) == '1') ) | \
                                    ( (str(time.strftime('%w', now)) == '0') & (str(alarm['day7']) == '1') ) ) ):
                            if (alarm['notify']
                                    == '1') & (alarm['text'] != ''):
                                if Core.isfile('/usr/bin/notify-send') | \
                                   Core.isfile('/usr/local/bin/notify-send'):
                                    Core.launch_command(
                                        'notify-send "' + alarm['text'] +
                                        '" -i task-due -t ' + str(144000) +
                                        '&')  # 2 min
                                elif Core.isfile('/usr/bin/notify-osd') | \
                                   Core.isfile('/usr/local/bin/notify-osd'):
                                    Core.launch_command(
                                        'notify-osd "' + alarm['text'] +
                                        '" -i task-due -t ' + str(144000) +
                                        '&')  # 2 min
                                else:
                                    try:
                                        import pynotify
                                        pynotify.init("Alamclock notification")
                                        n = pynotify.Notification(
                                            alarm['text'], "", "task-due")
                                        n.set_urgency(
                                            pynotify.URGENCY_CRITICAL)
                                        n.set_timeout(144000)
                                        n.show()
                                    except:
                                        print "Error: need notify-osd or libnotify-bin or notify-send or python-notify"
                            if alarm['soundfile'] != '':  # /usr/bin/aplay -q
                                if Core.isfile('/usr/bin/mplayer') | \
                                   Core.isfile('/usr/local/bin/mplayer'):
                                    Core.launch_command('mplayer -quiet "' +
                                                        alarm['soundfile'] +
                                                        '"&')

                            if alarm['cmd'] != '':
                                Core.launch_command('"' + alarm['cmd'] + '"&')


                        elif (alarm['remind'] == '1') & (alarm['text'] != '') & \
                             ( ( (alarm['date_d'] != '') & \
                                 (str(alarm['date_m']) == str(time.strftime('%m', plus5min))) ) & \
                                 ((str(alarm['date_d']) == str(time.strftime('%d', plus5min)) ) & \
                                  (str(alarm['date_y']) == str(time.strftime('%Y', plus5min)) ) & \
                                  (str(alarm['time_h']) == str(time.strftime('%H', plus5min)) ) & \
                                  (str(alarm['time_m']) == str(time.strftime('%M', plus5min)) ) ) ) | \
                        \
                             ( ( (alarm['date_d'] == '') & \
                                 (str(alarm['time_m']) == str(time.strftime('%M', plus5min)) ) & \
                                 (str(alarm['time_h']) == str(time.strftime('%H', plus5min)) ) ) & \
                                   (( (str(time.strftime('%w', plus5min)) == '1') & (str(alarm['day1']) == '1') ) | \
                                    ( (str(time.strftime('%w', plus5min)) == '2') & (str(alarm['day2']) == '1') ) | \
                                    ( (str(time.strftime('%w', plus5min)) == '3') & (str(alarm['day3']) == '1') ) | \
                                    ( (str(time.strftime('%w', plus5min)) == '4') & (str(alarm['day4']) == '1') ) | \
                                    ( (str(time.strftime('%w', plus5min)) == '5') & (str(alarm['day5']) == '1') ) | \
                                    ( (str(time.strftime('%w', plus5min)) == '6') & (str(alarm['day6']) == '1') ) | \
                                    ( (str(time.strftime('%w', plus5min)) == '0') & (str(alarm['day7']) == '1') ) ) ):

                            if Core.isfile('/usr/bin/notify-send') | \
                               Core.isfile('/usr/local/bin/notify-send'):
                                Core.launch_command('notify-send "' + _(
                                    "Remind you that after about 5 minutes to do "
                                ) + alarm['text'] + '" -i task-due -t ' +
                                                    str(144000) + '&')  # 2 min
                            elif Core.isfile('/usr/bin/notify-osd') | \
                               Core.isfile('/usr/local/bin/notify-osd'):
                                Core.launch_command('notify-osd "' + _(
                                    "Remind you that after about 5 minutes to do "
                                ) + alarm['text'] + '" -i task-due -t ' +
                                                    str(144000) + '&')  # 2 min
                            else:
                                try:
                                    import pynotify
                                    pynotify.init("Alamclock notification")
                                    n = pynotify.Notification(
                                        _("Remind you that after about 5 minutes to do "
                                          ) + alarm['text'], "", "task-due")
                                    n.set_urgency(pynotify.URGENCY_CRITICAL)
                                    n.set_timeout(144000)
                                    n.show()
                                except:
                                    print "Error: need notify-osd or libnotify-bin or notify-send or python-notify"
        return True
 def onClicked(self, widget, event, action):
     Core.launch_command(action)
     self.toggle(self)
Beispiel #8
0
 def onClicked(self, widget):
     Core.launch_command(self.plugin.settings["mixer"])
 def open(self, widget, path):
     ## FIXME !!  this is a quick hack! do it better !!
     tmp_path = path.replace('%20', ' ')
     tmp_path = tmp_path.replace('%C3%A9', 'é')
     tmp_path = tmp_path.replace('%C3%A8', 'è')
     Core.launch_command('%s "%s"' % (self.plugin.settings['filemanager'], tmp_path))
Beispiel #10
0
    def onClicked(self, widget, event, cmd):

        Core.launch_command(cmd)
        self.toggle(self)
Beispiel #11
0
    def update_time(self):
        if self.locked:
            return True

        now = time.localtime()
        time_current = time.strftime('<span color="%s">%s</span>' % (self.settings['time_color'], self.settings['time']), now)
        if self.lb_date:
            date_current = time.strftime('<span color="%s">%s</span>' % (self.settings['date_color'], self.settings['date']), now)
        if not time_current == self.time_txt:
            self.lb_time.set_markup(time_current)
            self.time_txt = time_current
            if self.lb_date:
                self.lb_date.set_markup(date_current)
                self.date_txt = date_current
        if self.cfg['tooltips'] & (self.settings['tooltip'] != ''):
            self.calendarplugin.plugin.tooltip = time.strftime(self.settings['tooltip'], now)




        min_for_alarm_current = str(time.strftime('%M', now))
        if not min_for_alarm_current == self.min_for_alarm:
          self.min_for_alarm = min_for_alarm_current

          if self.alarmlist != []:
            plus5min = time.localtime( time.time() + 300 )  #5 minutes *60
            for alarm in self.alarmlist:
              if alarm != {}:
                if   ( ( (alarm['date_d'] != '') & \
                         (str(alarm['date_m']) == str(time.strftime('%m', now))) ) & \
                         ((str(alarm['date_d']) == str(time.strftime('%d', now)) ) & \
                          (str(alarm['date_y']) == str(time.strftime('%Y', now)) ) & \
                          (str(alarm['time_h']) == str(time.strftime('%H', now)) ) & \
                          (str(alarm['time_m']) == str(time.strftime('%M', now)) ) ) ) | \
                        \
                     ( ( (alarm['date_d'] == '') & \
                         (str(alarm['time_m']) == str(time.strftime('%M', now)) ) & \
                         (str(alarm['time_h']) == str(time.strftime('%H', now)) ) ) & \
                           (( (str(time.strftime('%w', now)) == '1') & (str(alarm['day1']) == '1') ) | \
                            ( (str(time.strftime('%w', now)) == '2') & (str(alarm['day2']) == '1') ) | \
                            ( (str(time.strftime('%w', now)) == '3') & (str(alarm['day3']) == '1') ) | \
                            ( (str(time.strftime('%w', now)) == '4') & (str(alarm['day4']) == '1') ) | \
                            ( (str(time.strftime('%w', now)) == '5') & (str(alarm['day5']) == '1') ) | \
                            ( (str(time.strftime('%w', now)) == '6') & (str(alarm['day6']) == '1') ) | \
                            ( (str(time.strftime('%w', now)) == '0') & (str(alarm['day7']) == '1') ) ) ):
                          if (alarm['notify'] == '1') & (alarm['text'] != ''):
                              if Core.isfile('/usr/bin/notify-send') | \
                                 Core.isfile('/usr/local/bin/notify-send'):
                                Core.launch_command('notify-send "'+alarm['text']+'" -i task-due -t '+str(144000)+'&')  # 2 min
                              elif Core.isfile('/usr/bin/notify-osd') | \
                                 Core.isfile('/usr/local/bin/notify-osd'):
                                Core.launch_command('notify-osd "'+alarm['text']+'" -i task-due -t '+str(144000)+'&')  # 2 min
                              else:
                                try:
                                  import pynotify
                                  pynotify.init("Alamclock notification")
                                  n = pynotify.Notification(alarm['text'], "", "task-due")
                                  n.set_urgency(pynotify.URGENCY_CRITICAL)
                                  n.set_timeout(144000)
                                  n.show()
                                except:
                                  print "Error: need notify-osd or libnotify-bin or notify-send or python-notify"
                          if alarm['soundfile'] != '':               # /usr/bin/aplay -q
                              if Core.isfile('/usr/bin/mplayer') | \
                                 Core.isfile('/usr/local/bin/mplayer'):
                                    Core.launch_command('mplayer -quiet "'+alarm['soundfile']+'"&')

                          if alarm['cmd'] != '':
                            Core.launch_command('"'+alarm['cmd']+'"&')


                elif (alarm['remind'] == '1') & (alarm['text'] != '') & \
                     ( ( (alarm['date_d'] != '') & \
                         (str(alarm['date_m']) == str(time.strftime('%m', plus5min))) ) & \
                         ((str(alarm['date_d']) == str(time.strftime('%d', plus5min)) ) & \
                          (str(alarm['date_y']) == str(time.strftime('%Y', plus5min)) ) & \
                          (str(alarm['time_h']) == str(time.strftime('%H', plus5min)) ) & \
                          (str(alarm['time_m']) == str(time.strftime('%M', plus5min)) ) ) ) | \
                        \
                     ( ( (alarm['date_d'] == '') & \
                         (str(alarm['time_m']) == str(time.strftime('%M', plus5min)) ) & \
                         (str(alarm['time_h']) == str(time.strftime('%H', plus5min)) ) ) & \
                           (( (str(time.strftime('%w', plus5min)) == '1') & (str(alarm['day1']) == '1') ) | \
                            ( (str(time.strftime('%w', plus5min)) == '2') & (str(alarm['day2']) == '1') ) | \
                            ( (str(time.strftime('%w', plus5min)) == '3') & (str(alarm['day3']) == '1') ) | \
                            ( (str(time.strftime('%w', plus5min)) == '4') & (str(alarm['day4']) == '1') ) | \
                            ( (str(time.strftime('%w', plus5min)) == '5') & (str(alarm['day5']) == '1') ) | \
                            ( (str(time.strftime('%w', plus5min)) == '6') & (str(alarm['day6']) == '1') ) | \
                            ( (str(time.strftime('%w', plus5min)) == '0') & (str(alarm['day7']) == '1') ) ) ):

                              if Core.isfile('/usr/bin/notify-send') | \
                                 Core.isfile('/usr/local/bin/notify-send'):
                                Core.launch_command('notify-send "'+_("Remind you that after about 5 minutes to do ")+alarm['text']+'" -i task-due -t '+str(144000)+'&')  # 2 min
                              elif Core.isfile('/usr/bin/notify-osd') | \
                                 Core.isfile('/usr/local/bin/notify-osd'):
                                Core.launch_command('notify-osd "'+_("Remind you that after about 5 minutes to do ")+alarm['text']+'" -i task-due -t '+str(144000)+'&')  # 2 min
                              else:
                                try:
                                  import pynotify
                                  pynotify.init("Alamclock notification")
                                  n = pynotify.Notification(_("Remind you that after about 5 minutes to do ")+alarm['text'], "", "task-due")
                                  n.set_urgency(pynotify.URGENCY_CRITICAL)
                                  n.set_timeout(144000)
                                  n.show()
                                except:
                                  print "Error: need notify-osd or libnotify-bin or notify-send or python-notify"
        return True
Beispiel #12
0
 def launch_app(self, widget, app):
     # Strip last part of path if it contains %<a-Z>
     command = app.Exec.split("%")[0]
     if app.Terminal:
         command = "%s -e %s" % (self.settings["terminal"], command)
     Core.launch_command(command)
Beispiel #13
0
 def launch_app(self, widget, app):
     # Strip last part of path if it contains %<a-Z>
     command = app.Exec.split('%')[0]
     if app.Terminal:
         command = '%s -e %s' % (self.settings['terminal'], command)
     Core.launch_command(command)
Beispiel #14
0
    def onClicked(self, widget, event, cmd):

        Core.launch_command(cmd)
        self.toggle(self)
Beispiel #15
0
 def onClick(self, widget, event):
     Core.launch_command(self.settings['cmd'])
Beispiel #16
0
 def open_dir(self, widget, path):
     Core.launch_command('%s "%s"' % (self.plugin.settings['filemanager'], urllib.unquote(path)))
Beispiel #17
0
                if self.cfg['tooltips']:
                    self.gmail.plugin.tooltip = _('No unread mail')
        else:
            #icon = 'stock_mail-unread'
            #icon = 'mail-mark-unread'
            icon = 'mail-unread'
            self.can_show_icon = True
            self.set_size_request(self.cfg['icon_size'], self.cfg['icon_size'])
            if self.cfg['tooltips']:
                self.gmail.plugin.tooltip = _('Unread mail : ') + str(
                    len(mail))
            if int(self.settings['play_sound']) == 1:
                if self.settings['file_sound'] != '':
                    if Core.isfile('/usr/bin/mplayer') | \
                       Core.isfile('/usr/local/bin/mplayer'):
                        Core.launch_command('mplayer -quiet "' +
                                            self.settings['file_sound'] + '"&')

        self.gmail.update_icon_status(icon)

        self.gmail.restart()
        return True

    def resize(self):
        self.gmail.restart()

    def on_init(self):
        if self.settings['hide_icon'] == 0:
            self.can_show_icon = True
            self.set_size_request(self.cfg['icon_size'], self.cfg['icon_size'])
        else:
            self.can_show_icon = False
 def onClick(self, widget, event):
     Core.launch_command(self.settings['cmd'])
Beispiel #19
0
 def onClicked(self, widget, event, action):
     Core.launch_command(action)
     ## hide window
     self.toggle(self)
Beispiel #20
0
 def enter_callback(self, widget):
     Core.launch_command(self.entry.get_text())
     self.entry.x_done = True
     self.entry.set_text("")
     self.toggle()
Beispiel #21
0
 def onClicked(self, widget):
     Core.launch_command(self.plugin.settings['mixer'])