Changeset 7546


Ignore:
Timestamp:
Jun 26, 2018, 2:22:02 PM (12 months ago)
Author:
jrpelegrina
Message:

Added error handling to menu bar indicator

Location:
bell-scheduler/trunk/fuentes
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • bell-scheduler/trunk/fuentes/bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator

    r7529 r7546  
    4343                context=ssl._create_unverified_context()
    4444                self.n4d = n4dclient.ServerProxy("https://"+server+":9779",context=context,allow_none=True)
    45                
    46                 #self._get_n4d_key()
    4745               
    4846                self.is_working=False
     
    194192                        self.show_message(message)
    195193                        time.sleep(2)
    196                         self.notify.close()
     194                        try:
     195                                self.notify.close()
     196                        except:
     197                                pass   
    197198                       
    198199                        return False           
     
    205206
    206207                try:
    207                         message=message+'\n'+"- "+self.info[1]+" "+self.info[0]+"\n- "+duration_label+str(self.info[2])
    208                        
     208                        message=message+'\n'+"- "+self.info["hour"]+" "+self.info["name"]+"\n- "+duration_label+str(self.info["duration"])
    209209                        self.notify=Notify.Notification.new("Bell Scheduler",message, "bell-scheduler")
    210210                        self.notify.set_hint("transient", GLib.Variant.new_boolean(True))
     
    218218        def get_bell_info(self):
    219219
    220                 self.info=[]
     220                self.info={}
    221221                seconds_label=_(" seconds")
    222 
    223                 bell_info=self.n4d.read_conf("",'BellSchedulerManager')["data"]
    224 
    225                 if os.path.exists(BellSchedulerIndicator.TARGET_FILE):
    226                         f=open(BellSchedulerIndicator.TARGET_FILE,'r')
    227                         bell_id=f.readline().split('\n')[0]
    228                         f.close()
    229 
    230                         name=bell_info[bell_id]["name"]
    231                         self.info.append(name)
    232                         hour=bell_info[bell_id]["hour"]
    233                         minute=bell_info[bell_id]["minute"]
    234                         format_hour=self._format_hour(hour,minute)
    235                         self.info.append(format_hour)
    236                         duration=bell_info[bell_id]["play"]["duration"]
    237                         if duration==0:
    238                                 duration=_("Full reproduction")
    239                         else:
    240                                 duration=str(duration)+""+seconds_label
    241                         self.info.append(duration)
    242 
     222                error=True
     223
     224                bell_info=self.n4d.read_conf("",'BellSchedulerManager')
     225
     226                if bell_info["status"]:         
     227
     228                        if os.path.exists(BellSchedulerIndicator.TARGET_FILE):
     229                                f=open(BellSchedulerIndicator.TARGET_FILE,'r')
     230                                bell_id=f.readline().split('\n')[0]
     231                                f.close()
     232
     233                                if len(bell_info["data"])>0:
     234                                        try:
     235                                                self.info["name"]=bell_info["data"][bell_id]["name"]
     236                                                hour=bell_info["data"][bell_id]["hour"]
     237                                                minute=bell_info["data"][bell_id]["minute"]
     238                                                format_hour=self._format_hour(hour,minute)
     239                                                self.info["hour"]=format_hour
     240                                                duration=bell_info["data"][bell_id]["play"]["duration"]
     241                                                if duration==0:
     242                                                        duration=_("Full reproduction")
     243                                                else:
     244                                                        duration=str(duration)+""+seconds_label
     245                                                self.info["duration"]=duration
     246                                                error=False
     247                                        except:
     248                                                pass
     249
     250                if error:
     251                        msg_error=_("Error. Not available")
     252                        self.info["name"]=msg_error
     253                        self.info["hour"]=msg_error
     254                        self.info["duration"]=msg_error
     255
     256                               
    243257
    244258        #def get_bell_info     
  • bell-scheduler/trunk/fuentes/debian/control

    r7487 r7546  
    3030Architecture: all
    3131Depends: ${misc:Depends}, ${python3:Depends},n4d-bellscheduler (= ${binary:Version})
    32 Description: Bell Scheduler plugin
    33   Plugins supporting bell-scheduler functional
     32Description: Bell Scheduler menu bar indicator
     33  Provides a indicator to menu bar that allows to stop the alarm
    3434 
    3535
  • bell-scheduler/trunk/fuentes/debian/n4d-bellscheduler.postinst

    r7523 r7546  
    77        n4d-modules enable-plugin /etc/n4d/conf.d/BellSchedulerManager || true
    88       
    9         if dpkg --compare-versions "$2" lt 0.2.9; then
    10                 echo "Update bell files to use Indicator..."
     9        if dpkg --compare-versions "$2" lt 0.3; then
     10                echo "Coping script to update bell file to use indicator"
    1111                cp /usr/share/bell-scheduler/one-shots/update-indicator-token.sh /etc/n4d/one-shot/
    1212                deb-systemd-invoke restart n4d || true
  • bell-scheduler/trunk/fuentes/translations/bell-scheduler.pot

    r7527 r7546  
    99"Project-Id-Version: PACKAGE VERSION\n"
    1010"Report-Msgid-Bugs-To: \n"
    11 "POT-Creation-Date: 2018-06-25 12:39+0200\n"
     11"POT-Creation-Date: 2018-06-26 13:48+0200\n"
    1212"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1313"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    347347msgstr ""
    348348
    349 #: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:82
     349#: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:80
    350350msgid "Playing the scheduled bell:"
    351351msgstr ""
    352352
    353 #: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:95
     353#: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:93
    354354msgid "Stop the bell now"
    355355msgstr ""
    356356
    357 #: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:192
     357#: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:191
    358358msgid "The scheduled bell has ended:"
    359359msgstr ""
    360360
    361 #: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:203
     361#: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:205
    362362msgid "Duration: "
    363363msgstr ""
    364364
    365 #: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:216
     365#: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:222
    366366msgid " seconds"
    367367msgstr ""
    368368
    369 #: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:233
     369#: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:243
    370370msgid "Full reproduction"
    371371msgstr ""
     372
     373#: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:252
     374msgid "Error. Not available"
     375msgstr ""
  • bell-scheduler/trunk/fuentes/translations/ca_ES.UTF-8@valencia.po

    r7527 r7546  
    99"Project-Id-Version: \n"
    1010"Report-Msgid-Bugs-To: \n"
    11 "POT-Creation-Date: 2018-06-25 13:05+0200\n"
    12 "PO-Revision-Date: 2018-06-25 13:06+0200\n"
     11"POT-Creation-Date: 2018-06-26 13:49+0200\n"
     12"PO-Revision-Date: 2018-06-26 13:49+0200\n"
    1313"Last-Translator: Pilar Embid Giner <embid_mar@gva.es>\n"
    1414"Language-Team: LliureX\n"
     
    370370msgstr "No executes les alarmes en període de vacances"
    371371
    372 #: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:82
     372#: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:80
    373373msgid "Playing the scheduled bell:"
    374374msgstr "S'està reproduint l'alarma programada:"
    375375
    376 #: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:95
     376#: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:93
    377377msgid "Stop the bell now"
    378378msgstr "Para l'alarma ara"
    379379
    380 #: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:192
     380#: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:191
    381381msgid "The scheduled bell has ended:"
    382382msgstr "L'alarma programada ha finalitzat:"
    383383
    384 #: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:203
     384#: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:205
    385385msgid "Duration: "
    386386msgstr "Durada: "
    387387
    388 #: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:216
     388#: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:222
    389389msgid " seconds"
    390390msgstr " segons"
    391391
    392 #: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:233
     392#: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:243
    393393msgid "Full reproduction"
    394394msgstr "Reproducció completa"
     395
     396#: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:252
     397msgid "Error. Not available"
     398msgstr "Error. No disponible"
  • bell-scheduler/trunk/fuentes/translations/ca_ES@valencia.po

    r7527 r7546  
    99"Project-Id-Version: \n"
    1010"Report-Msgid-Bugs-To: \n"
    11 "POT-Creation-Date: 2018-06-25 13:02+0200\n"
    12 "PO-Revision-Date: 2018-06-25 13:06+0200\n"
     11"POT-Creation-Date: 2018-06-26 13:49+0200\n"
     12"PO-Revision-Date: 2018-06-26 13:49+0200\n"
    1313"Last-Translator: Pilar Embid Giner <embid_mar@gva.es>\n"
    1414"Language-Team: LliureX\n"
     
    370370msgstr "No executes les alarmes en període de vacances"
    371371
    372 #: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:82
     372#: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:80
    373373msgid "Playing the scheduled bell:"
    374374msgstr "S'està reproduint l'alarma programada:"
    375375
    376 #: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:95
     376#: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:93
    377377msgid "Stop the bell now"
    378378msgstr "Para l'alarma ara"
    379379
    380 #: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:192
     380#: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:191
    381381msgid "The scheduled bell has ended:"
    382382msgstr "L'alarma programada ha finalitzat:"
    383383
    384 #: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:203
     384#: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:205
    385385msgid "Duration: "
    386386msgstr "Durada: "
    387387
    388 #: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:216
     388#: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:222
    389389msgid " seconds"
    390390msgstr " segons"
    391391
    392 #: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:233
     392#: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:243
    393393msgid "Full reproduction"
    394394msgstr "Reproducció completa"
     395
     396#: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:252
     397msgid "Error. Not available"
     398msgstr "Error. No disponible"
  • bell-scheduler/trunk/fuentes/translations/es.po

    r7527 r7546  
    99"Project-Id-Version: \n"
    1010"Report-Msgid-Bugs-To: \n"
    11 "POT-Creation-Date: 2018-06-25 12:39+0200\n"
    12 "PO-Revision-Date: 2018-06-25 12:40+0200\n"
     11"POT-Creation-Date: 2018-06-26 13:48+0200\n"
     12"PO-Revision-Date: 2018-06-26 13:49+0200\n"
    1313"Last-Translator: lliurex <lliurex@gva.es>\n"
    1414"Language-Team: Spanish\n"
     
    370370msgstr "No ejecutar las alarmas los días festivos configurados"
    371371
    372 #: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:82
     372#: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:80
    373373msgid "Playing the scheduled bell:"
    374374msgstr "Reproduciendo la alarma programada:"
    375375
    376 #: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:95
     376#: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:93
    377377msgid "Stop the bell now"
    378378msgstr "Detener la alarma ahora"
    379379
    380 #: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:192
     380#: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:191
    381381msgid "The scheduled bell has ended:"
    382382msgstr "La alarma programada ha finalizado:"
    383383
    384 #: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:203
     384#: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:205
    385385msgid "Duration: "
    386386msgstr "Duración: "
    387387
    388 #: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:216
     388#: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:222
    389389msgid " seconds"
    390390msgstr " segundos"
    391391
    392 #: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:233
     392#: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:243
    393393msgid "Full reproduction"
    394394msgstr "Reproducción completa"
     395
     396#: bell-scheduler-indicator.install/usr/bin/bell-scheduler-indicator:252
     397msgid "Error. Not available"
     398msgstr "Error. No disponible"
Note: See TracChangeset for help on using the changeset viewer.