Changeset 6375


Ignore:
Timestamp:
Nov 23, 2017, 12:35:54 PM (23 months ago)
Author:
Juanma
Message:

localized tasks and commands

Location:
taskscheduler/trunk/fuentes
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • taskscheduler/trunk/fuentes/debian/changelog

    r6365 r6375  
     1taskscheduler (0.3.2) xenial; urgency=medium
     2
     3  * Localized tasks and commands
     4
     5 -- Juanma Navarro Mañez <juanma1980@gmail.com>  Thu, 23 Nov 2017 12:35:09 +0100
     6
    17taskscheduler (0.3.1) xenial; urgency=medium
    28
  • taskscheduler/trunk/fuentes/debian/control

    r6359 r6375  
    66Build-Depends: llxsrchelper,debhelper (>= 7.0),python3-all, llxcfg-dev, python3-setuptools
    77Standards-Version: 3.9.5
    8 X-Python3-Version: >= 3.5
    98
    109Package: python3-taskscheduler
     
    1514Package: taskscheduler
    1615Architecture: all
    17 Depends: ${misc:Depends}, ${python3:Depends}, python3-taskscheduler,python3-n4dgtklogin,n4d-taskscheduler-client
     16Depends: ${misc:Depends}, ${python3:Depends}, python3-taskscheduler (= $binary:Version),python3-n4dgtklogin (>=0.3.2),n4d-taskscheduler-client (= $binary:Version), taskscheduler-data (= $binary:Version)
    1817Description: Main taskschedular program
    1918
     
    2726Depends: ${misc:Depends}, ${python3:Depends},n4d-taskscheduler-server
    2827Description: client side of taskscheduler
     28
     29Package: taskscheduler-data
     30Architecture: all
     31Depends: ${misc:Depends}, ${python3:Depends}
     32Description: Taskschedular data files
  • taskscheduler/trunk/fuentes/debian/taskscheduler.install

    r6269 r6375  
    11scheduler-gui.install/* /
    2 files.install/* /
  • taskscheduler/trunk/fuentes/lliurex-po/generate_po.sh

    r6269 r6375  
    33PYTHON_FILES="../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py ../python3-taskscheduler.install/usr/share/taskscheduler/*.py"
    44UI_FILES="../scheduler-gui.install/usr/share/taskscheduler/rsrc/taskScheduler.ui"
     5CMD_DIR="../files.install/etc/scheduler/conf.d/commands"
     6TASKS_DIR="../files.install/etc/scheduler/conf.d/tasks"
    57
    68mkdir -p taskscheduler/
     
    810xgettext $UI_FILES $PYTHON_FILES -o taskscheduler/taskscheduler.pot
    911
     12DIR=$PWD
     13cd $CMD_DIR
     14for i in *json
     15do
     16        awk -v wrkdir=$DIR -v filename=$CMD_DIR"/"$i '{
     17        if ($0~":")
     18        {
     19                outfile=wrkdir"/taskscheduler/taskscheduler.pot"
     20                printf ("#: %s:%s\n",filename,NR) >> outfile
     21                split($0,a,":")
     22                gsub(/\"/,"",a[1])
     23                gsub(/\t*/,"",a[1])
     24                printf ("msgid \"%s\"\n",a[1]) >> outfile
     25                printf("msgstr \"\"\n\n") >> outfile
    1026
     27        }
     28        }' $i
     29done
     30cd $DIR
     31cd $TASKS_DIR
     32for i in *json
     33do
     34        awk -v wrkdir=$DIR  -v filename=$TASKS_DIR"/"$i '{
     35        if ($0~":")
     36        {
     37                outfile=wrkdir"/taskscheduler/taskscheduler.pot"
     38                printf ("#: %s:%s\n",filename,NR) >> outfile
     39                split($0,a,":")
     40                gsub(/\"/,"",a[1])
     41                gsub(/\t*/,"",a[1])
     42                printf ("msgid \"%s\"\n",a[1]) >> outfile
     43                printf("msgstr \"\"\n\n") >> outfile
     44        }
     45        }' $i
     46done
     47cd $DIR
  • taskscheduler/trunk/fuentes/lliurex-po/taskscheduler/es.po

    r6357 r6375  
    88"Project-Id-Version: \n"
    99"Report-Msgid-Bugs-To: \n"
    10 "POT-Creation-Date: 2017-11-20 12:49+0100\n"
    11 "PO-Revision-Date: 2017-11-20 12:49+0100\n"
     10"POT-Creation-Date: 2017-11-22 10:37+0100\n"
     11"PO-Revision-Date: 2017-11-22 10:38+0100\n"
    1212"Last-Translator: \n"
    1313"Language-Team: \n"
     
    3232
    3333#: ../scheduler-gui.install/usr/share/taskscheduler/rsrc/taskScheduler.ui:58
    34 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:679
    35 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:720
     34#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:680
     35#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:721
    3636msgid "Command"
    3737msgstr "Acción"
     
    176176#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:147
    177177#: ../python3-taskscheduler.install/usr/share/taskscheduler/cronParser.py:28
    178 msgid "Thursday"
    179 msgstr "Martes"
     178msgid "Tuesday"
     179msgstr "Jueves"
    180180
    181181#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:148
     
    186186#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:149
    187187#: ../python3-taskscheduler.install/usr/share/taskscheduler/cronParser.py:28
    188 msgid "Tuesday"
    189 msgstr "Jueves"
     188msgid "Thursday"
     189msgstr "Martes"
    190190
    191191#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:150
     
    274274msgstr "Programador de Tareas"
    275275
    276 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:648
     276#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:649
    277277msgid "Task"
    278278msgstr "Tarea"
    279279
    280 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:655
     280#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:656
    281281msgid "Serial"
    282282msgstr "Serial"
    283283
    284 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:663
     284#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:664
    285285msgid "When"
    286286msgstr "Cuando"
    287287
    288 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:671
     288#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:672
    289289msgid "Remove"
    290290msgstr "Eliminar"
    291291
    292 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:709
     292#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:710
    293293msgid "A descriptive name for the command"
    294294msgstr "Un nombre descriptivo para el comando"
    295295
    296 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:710
    297296#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:711
     297#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:712
    298298msgid "Task name"
    299299msgstr "Nombre de la tarea"
    300300
    301 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:724
     301#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:725
    302302msgid "Needs a file"
    303303msgstr "Necesita fichero"
    304304
    305 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:725
     305#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:726
    306306msgid "Mark if the command will launch a file"
    307307msgstr "Selecciona si el comando lanza un fichero"
    308308
    309 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:727
     309#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:728
    310310msgid "Select the file that will be launched"
    311311msgstr "Selecciona el fichero a lanzar"
    312312
    313 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:730
     313#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:731
    314314msgid "Needed arguments"
    315315msgstr "Argumentos requeridos"
    316316
    317 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:731
     317#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:732
    318318msgid "Put here the arguments for the command (if any)"
    319319msgstr "Escribe aquí los argumentos para el comando (si los hay)"
    320320
    321 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:732
     321#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:733
    322322msgid "Arguments"
    323323msgstr "Argumentos"
    324324
    325 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:846
     325#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:763
     326#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:877
     327msgid "Task saved"
     328msgstr "Tarea guardada"
     329
     330#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:852
    326331msgid "Are you sure to delete this task?"
    327332msgstr "¿Desea borrar esta tarea?"
    328333
    329 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:871
    330 msgid "Task saved"
    331 msgstr "Tarea guardada"
    332 
    333 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:934
     334#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:951
    334335msgid "Task updated"
    335336msgstr "Tarea actualizada"
     
    496497msgstr "Diciembre"
    497498
     499#: ../files.install/etc/scheduler/conf.d/commands/commands.json:2
     500msgid "Play sound"
     501msgstr "Reproducir sonido"
     502
     503#: ../files.install/etc/scheduler/conf.d/commands/commands.json:3
     504msgid "Reminder"
     505msgstr "Recordatorio"
     506
     507#: ../files.install/etc/scheduler/conf.d/tasks/tasks.json:2
     508msgid "Maintenance"
     509msgstr "Mantenimiento"
     510
     511#: ../files.install/etc/scheduler/conf.d/tasks/tasks.json:4
     512msgid "Update mirror"
     513msgstr "Actualizar mirror"
     514
     515#: ../files.install/etc/scheduler/conf.d/tasks/tasks.json:5
     516msgid "Update Lliurex"
     517msgstr "Actualizar Lliurex"
     518
    498519#~ msgid "Show remote tasks"
    499520#~ msgstr "Ver tareas remotas"
  • taskscheduler/trunk/fuentes/lliurex-po/taskscheduler/taskscheduler.pot

    r6357 r6375  
    99"Project-Id-Version: PACKAGE VERSION\n"
    1010"Report-Msgid-Bugs-To: \n"
    11 "POT-Creation-Date: 2017-11-20 12:48+0100\n"
     11"POT-Creation-Date: 2017-11-22 10:22+0100\n"
    1212"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1313"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    3131
    3232#: ../scheduler-gui.install/usr/share/taskscheduler/rsrc/taskScheduler.ui:58
    33 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:679
    34 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:720
     33#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:680
     34#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:721
    3535msgid "Command"
    3636msgstr ""
     
    171171#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:147
    172172#: ../python3-taskscheduler.install/usr/share/taskscheduler/cronParser.py:28
    173 msgid "Thursday"
     173msgid "Tuesday"
    174174msgstr ""
    175175
     
    181181#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:149
    182182#: ../python3-taskscheduler.install/usr/share/taskscheduler/cronParser.py:28
    183 msgid "Tuesday"
     183msgid "Thursday"
    184184msgstr ""
    185185
     
    264264msgstr ""
    265265
    266 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:648
     266#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:649
    267267msgid "Task"
    268268msgstr ""
    269269
    270 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:655
     270#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:656
    271271msgid "Serial"
    272272msgstr ""
    273273
    274 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:663
     274#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:664
    275275msgid "When"
    276276msgstr ""
    277277
    278 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:671
     278#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:672
    279279msgid "Remove"
    280280msgstr ""
    281281
    282 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:709
     282#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:710
    283283msgid "A descriptive name for the command"
    284284msgstr ""
    285285
    286 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:710
    287286#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:711
     287#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:712
    288288msgid "Task name"
    289289msgstr ""
    290290
    291 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:724
     291#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:725
    292292msgid "Needs a file"
    293293msgstr ""
    294294
    295 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:725
     295#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:726
    296296msgid "Mark if the command will launch a file"
    297297msgstr ""
    298298
    299 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:727
     299#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:728
    300300msgid "Select the file that will be launched"
    301301msgstr ""
    302302
    303 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:730
     303#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:731
    304304msgid "Needed arguments"
    305305msgstr ""
    306306
    307 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:731
     307#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:732
    308308msgid "Put here the arguments for the command (if any)"
    309309msgstr ""
    310310
    311 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:732
     311#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:733
    312312msgid "Arguments"
    313313msgstr ""
    314314
    315 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:846
     315#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:763
     316#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:877
     317msgid "Task saved"
     318msgstr ""
     319
     320#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:852
    316321msgid "Are you sure to delete this task?"
    317322msgstr ""
    318323
    319 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:871
    320 msgid "Task saved"
    321 msgstr ""
    322 
    323 #: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:934
     324#: ../scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py:951
    324325msgid "Task updated"
    325326msgstr ""
     
    485486msgid "December"
    486487msgstr ""
     488#: ../files.install/etc/scheduler/conf.d/commands/commands.json:2
     489msgid "Play sound"
     490msgstr ""
     491
     492#: ../files.install/etc/scheduler/conf.d/commands/commands.json:3
     493msgid "Reminder"
     494msgstr ""
     495
     496#: ../files.install/etc/scheduler/conf.d/tasks/tasks.json:2
     497msgid "Maintenance"
     498msgstr ""
     499
     500#: ../files.install/etc/scheduler/conf.d/tasks/tasks.json:4
     501msgid "Update mirror"
     502msgstr ""
     503
     504#: ../files.install/etc/scheduler/conf.d/tasks/tasks.json:5
     505msgid "Update Lliurex"
     506msgstr ""
     507
  • taskscheduler/trunk/fuentes/python3-taskscheduler.install/usr/share/taskscheduler/taskscheduler.py

    r6361 r6375  
    2121                self.conf_dir="/etc/scheduler/conf.d/"
    2222                self.tasks_dir=self.conf_dir+'/tasks'
    23                 self.custom_tasks=self.tasks_dir+"/custom.json"
     23                self.custom_tasks=self.tasks_dir+"/personal.json"
    2424                self.commands_file=self.conf_dir+'/commands/commands.json'
    2525                self.sched_dir="/etc/scheduler/tasks.d"
  • taskscheduler/trunk/fuentes/scheduler-gui.install/usr/share/taskscheduler/bin/taskScheduler.py

    r6361 r6375  
    1616#import commands
    1717from gi.repository import Gtk, Gdk, GdkPixbuf, GObject, GLib, PangoCairo, Pango
    18 
     18import time
    1919from taskscheduler.taskscheduler import TaskScheduler as scheduler
    2020from taskscheduler.cronParser import cronParser
     
    3333LOCK_PATH="/var/run/taskScheduler.lock"
    3434WIDGET_MARGIN=6
    35 DBG=0
     35DBG=1
    3636class TaskDetails:
    3737       
     
    575575                        self.inf_message.hide()
    576576                self.inf_message.connect('response',hide)
     577#               self.inf_message.props.no_show_all=True
    577578
    578579                self.inf_question=Gtk.InfoBar()
     
    583584                self.inf_question.set_halign(Gtk.Align.CENTER)
    584585                self.inf_question.set_valign(Gtk.Align.CENTER)
     586#               self.inf_question.props.no_show_all=True
    585587                self.main_box.pack_start(self.inf_question,False,False,0)
    586588                self.main_box.pack_start(self.inf_message,False,False,0)
     
    590592                #Toolbar
    591593                self.toolbar=builder.get_object("toolbar")
     594                self.toolbar.set_visible(False)
    592595                self.btn_add_task=builder.get_object("btn_add_task")
    593596                self.btn_add_task.connect("button-release-event", self.add_task_clicked)
     
    610613                image.set_from_file(REMOVE_ICON)               
    611614                self.remove_icon=image.get_pixbuf()
    612                 #Load stack
     615
     616                self.stack.add_titled(self.tasks_box, "tasks", "Tasks")
    613617                self.stack.add_titled(self.manage_box, "manage", "Manage")
    614618                self.stack.add_titled(self.add_task_box, "add", "Add Task")
    615619                self.stack.add_titled(self.loginBox, "login", "Login")
    616                 self.stack.add_titled(self.tasks_box, "tasks", "Tasks")
    617 
    618620                #Packing
    619621                self.main_box.pack_start(self.stack,True,False,5)
     622                self.toolbar.props.no_show_all=True
     623                self.window.connect("destroy",self.quit)
    620624                self.window.show_all()
    621                 self.toolbar.hide()
     625                self.inf_message.hide()
    622626                self.inf_question.hide()
    623                 self.inf_message.hide()
    624                 self.window.connect("destroy",self.quit)
    625627                self.set_css_info()
    626                 self.task_list=[]
     628                #Load stack
     629                self.stack.set_transition_type(Gtk.StackTransitionType.NONE)
     630                self.stack.set_visible_child_name("login")
    627631                self.stack.set_transition_type(Gtk.StackTransitionType.SLIDE_LEFT)
    628                 self.stack.set_visible_child_name("login")
    629 
    630                 GObject.threads_init()
     632
    631633                Gtk.main()
    632634
     
    716718                cmb_cmds=Gtk.ComboBoxText()
    717719                cmds=self.scheduler_client.get_commands()
     720                orig_cmd={}
    718721                for cmd in cmds.keys():
    719                         cmb_cmds.append_text(cmd)
     722                        orig_cmd[_(cmd)]=cmd
     723                        cmb_cmds.append_text(_(cmd))
    720724
    721725                lbl_cmd=Gtk.Label(_("Command"))
     
    739743                btn_file.set_sensitive(False)
    740744                self.btn_apply_manage=builder.get_object("btn_apply_manage")
    741                 self.btn_apply_manage.connect("clicked",self._add_custom_task,txt_taskname,cmb_cmds,txt_params,chk_parm_is_file,btn_file)
     745                self.btn_apply_manage.connect("clicked",self._add_custom_task,txt_taskname,cmb_cmds,txt_params,chk_parm_is_file,btn_file,orig_cmd)
    742746                self.btn_back_manage=builder.get_object("btn_back_manage")
    743747                self.btn_back_manage.connect("clicked",self._cancel_manage_clicked)
     
    753757        #def _enable_filechooser
    754758
    755         def _add_custom_task(self,widget,w_name,w_cmd,w_parms,w_chk,w_file):
     759        def _add_custom_task(self,widget,w_name,w_cmd,w_parms,w_chk,w_file,orig_cmd):
    756760                name=w_name.get_text()
    757                 cmd_desc=w_cmd.get_active_text()
     761                cmd=w_cmd.get_active_text()
     762                cmd_desc=orig_cmd[cmd]
    758763                parms=w_parms.get_text()
    759764                cmd=self.scheduler_client.get_command_cmd(cmd_desc)
     
    765770
    766771        def _signin(self,user=None,pwd=None,server=None,data=None):
    767                 self.stack.set_transition_type(Gtk.StackTransitionType.SLIDE_LEFT)
    768                 self.stack.set_visible_child_name("tasks")
    769                 self.toolbar.show()
    770772                self.scheduler_client.set_credentials(user,pwd,server)
    771773                if server=='localhost':
     
    775777                else:
    776778                        self.btn_remote_tasks.set_active(True)
     779                self.toolbar.show()
    777780        #def _signin
    778781
     
    781784                self.scheduled_tasks={}
    782785                tasks=[]
     786                self.orig_tasks={}
     787                self.orig_cmd={}
    783788                tasks=self.scheduler_client.get_scheduled_tasks(task_type)
    784789                self.tasks_store.clear()
    785790                if type(tasks)==type([]):       
    786791                        for task in tasks:
    787                                 for task_name,task_serialized in task.items():
    788                                         self.scheduled_tasks[task_name]=task_serialized
    789                                         for serial,task in task_serialized.items():
     792                                for task_name,task_serial in task.items():
     793                                        self.scheduled_tasks[task_name]=task_serial
     794                                        for serial,task in task_serial.items():
    790795                                                parser=cronParser()
    791796                                                parsed_calendar=''
     
    793798                                                task['cmd']=task['cmd'].replace(self.ldm_helper+' ','')
    794799                                                task['action']=self.scheduler_client.get_task_description(task['cmd'])
    795                                                 self.tasks_store.append(("<span font='Roboto'><b>"+task['action']+"</b></span>\n"+\
     800                                                self.orig_cmd[_(task['action'])]=task['action']
     801                                                self.orig_tasks[_(task_name)]=task_name
     802                                                self.tasks_store.append(("<span font='Roboto'><b>"+_(task['action'])+"</b></span>\n"+\
    796803                                                                        "<span font='Roboto' size='small'><i>"+\
    797                                                                         task_name+"</i></span>",serial,"<span font='Roboto' size='small'>"+\
     804                                                                        _(task_name)+"</i></span>",serial,"<span font='Roboto' size='small'>"+\
    798805                                                                        parsed_calendar+"</span>",self.remove_icon,'oooo'))
    799806        #def populate_tasks_tv
     
    859866
    860867        def save_task_details(self,widget):
    861                 task_name=self.cmb_task_names.get_active_text()
    862                 task_action=self.cmb_task_cmds.get_active_text()
     868                name=self.cmb_task_names.get_active_text()
     869                task_name=self.orig_tasks[name]
     870                action=self.cmb_task_cmds.get_active_text()
     871                task_action=self.orig_cmd[action]
    863872                tasks=self.scheduler_client.get_available_tasks()
    864                 print(tasks)
    865873                task_cmd=tasks[task_name][task_action]
    866874                task_type='local'
     
    880888
    881889        def view_tasks_clicked(self,widget,task_type):
    882                 self.stack.set_transition_type(Gtk.StackTransitionType.SLIDE_RIGHT)
    883                 self.stack.set_visible_child_name("tasks")     
    884890                if widget:
    885891                        if not widget.get_active():
     
    902908                self.tasks_tv.set_model(self.tasks_store_filter)
    903909                self.tasks_tv.set_cursor(0)
     910                if self.stack.get_visible_child_name!='tasks':
     911#                       self.stack.set_transition_type(Gtk.StackTransitionType.SLIDE_RIGHT)
     912                        self.stack.set_visible_child_name("tasks")
    904913#               self.cancel_add_clicked(widget,task_type)
    905914        #def view_tasks_clicked
     
    923932                tasks=[]
    924933                names=[]
     934                self.orig_tasks={}
    925935                self.cmb_task_names.remove_all()
    926936                tasks=self.scheduler_client.get_available_tasks()
     
    928938                        if name not in names:
    929939                                names.append(name)
    930                                 self.cmb_task_names.append_text(name)
     940                                self.orig_tasks[_(name)]=name
     941                                self.cmb_task_names.append_text(_(name))
    931942               
    932943                self.cmb_task_names.connect('changed',self.load_add_task_details_cmds,tasks)
     
    936947        def load_add_task_details_cmds(self,widget,tasks):
    937948                actions=[]
     949                self.orig_cmd={}
    938950                self.cmb_task_cmds.remove_all()
    939951                task_name=self.cmb_task_names.get_active_text()
    940952                if task_name:
    941                         for action in tasks[task_name].keys():
     953                        orig_name=self.orig_tasks[task_name]
     954                        for action in tasks[orig_name].keys():
    942955                                if action not in actions:
     956                                        self.orig_cmd[_(action)]=action
    943957                                        actions.append(action)
    944                                         self.cmb_task_cmds.append_text(action)
     958                                        self.cmb_task_cmds.append_text(_(action))
    945959                self.cmb_task_cmds.set_active(0)
    946960        #def load_add_task_details_cmds
     
    9901004        def manage_remove_responses(self,widget,response,model,task_name,task_serial,task_cmd,task_type,data):
    9911005                if response==Gtk.ResponseType.OK:
    992                         self.scheduler_client.remove_task(task_name,task_serial,task_cmd,task_type)
     1006                        name=self.orig_tasks[task_name]
     1007                        cmd=self.orig_cmd[task_cmd]
     1008                        self.scheduler_client.remove_task(name,task_serial,cmd,task_type)
    9931009                        self.populate_tasks_tv(task_type)
    9941010                        self.tasks_tv.set_cursor(0)
     
    10791095#class TaskScheduler
    10801096
     1097GObject.threads_init()
    10811098t=TaskScheduler()
    10821099t.start_gui()           
  • taskscheduler/trunk/fuentes/server-scheduler.install/usr/share/n4d/python-plugins/SchedulerServer.py

    r6314 r6375  
    1515                self.schedTasksDir=self.taskDir+"/scheduled"
    1616                self.available_tasks_dir="/etc/scheduler/conf.d/tasks"
    17                 self.custom_tasks=self.available_tasks_dir+"/custom.json"
     17                self.custom_tasks=self.available_tasks_dir+"/personal.json"
    1818                self.remote_tasks_dir=self.taskDir+"/remote"
    1919                self.local_tasks_dir=self.taskDir+"/local"
     
    166166                if os.path.isfile(self.custom_tasks):
    167167                        tasks=json.loads(open(self.custom_tasks).read())
    168                         if not 'Custom' in tasks.keys():
    169                                 tasks['Custom']={}
    170                 else:
    171                         tasks['Custom']={}
    172                 new_task[cmd_name]=cmd+' '+parms
    173                 tasks['Custom'].update(new_task)
     168                        if not 'Personal' in tasks.keys():
     169                                tasks['Personal']={}
     170                else:
     171                        tasks['Personal']={}
     172                if '%s' in cmd:
     173                        cmd=cmd.replace('%s','')
     174                        new_task[cmd_name]=cmd+' "'+parms+'"'
     175                else:
     176                        new_task[cmd_name]=cmd+' '+parms
     177                tasks['Personal'].update(new_task)
    174178                try:
    175179                        with open(self.custom_tasks,'w') as json_data:
Note: See TracChangeset for help on using the changeset viewer.