Changeset 951

Show
Ignore:
Timestamp:
08/08/08 18:21:15 (4 months ago)
Author:
mariodebian
Message:

tcosmonitor (0.2.16~rc6)

The extensions pre release

  • Move a lot of code from TcosActions?.py to extensions/*.py
  • New class TcosExtensions?.py (every extension heredate from it)
  • This release is not finished svn commit -m
Location:
trunk/tcosmonitor
Files:
16 added
13 modified

Legend:

Unmodified
Added
Removed
  • trunk/tcosmonitor/Initialize.py

    r944 r951  
    172172         
    173173     
    174     def initask(self): 
    175         self.main.ask_ip=None 
    176          
    177         self.main.ask = self.main.ui.get_widget('askwindow') 
    178         self.main.ask.connect('delete-event', self.main.actions.askwindow_close ) 
    179         self.main.ask.set_icon_from_file(shared.IMG_DIR +\ 
    180                                          'tcos-icon-32x32.png') 
    181          
    182          
    183         self.main.ask_label = self.main.ui.get_widget('txt_asklabel') 
    184         ## arrastrar y soltar 
    185         self.main.ask_fixed = self.main.ui.get_widget('ask_fixed') 
    186         self.main.ask_dragdrop = self.main.ui.get_widget('label99') 
    187         self.main.image_entry = self.main.ui.get_widget('image_askentry') 
    188         self.main.image_entry.drag_dest_set( gtk.DEST_DEFAULT_ALL, [( 'text/uri-list', 0, 2 ),], gtk.gdk.ACTION_DEFAULT | gtk.gdk.ACTION_COPY) 
    189         self.main.image_entry.connect( 'drag_data_received', self.main.actions.on_drag_data_received) 
    190         self.main.ask_fixed.hide() 
    191         self.main.image_entry.hide() 
    192         self.main.ask_dragdrop.hide() 
    193         ## fin arrastrar y soltar 
    194         self.liststore = gtk.ListStore(str) 
    195         for s in shared.appslist: 
    196             self.liststore.append([s]) 
    197              
    198         self.main.ask_entry = self.main.ui.get_widget('txt_askentry') 
    199         self.main.ask_completion = gtk.EntryCompletion() 
    200         self.main.ask_completion.set_model(self.liststore) 
    201         self.main.ask_entry.set_completion(self.main.ask_completion) 
    202         self.main.ask_completion.set_text_column(0) 
    203          
    204         self.main.ask_completion.connect('match-selected', self.match_cb) 
    205         self.main.ask_entry.connect('activate', self.activate_cb) 
    206          
    207         self.main.ask_cancel = self.main.ui.get_widget('ask_cancelbutton') 
    208         self.main.ask_exec = self.main.ui.get_widget('ask_exebutton') 
    209          
    210         # buttons signals 
    211         self.main.ask_exec.connect('clicked', self.main.actions.on_ask_exec_click) 
    212         self.main.ask_cancel.connect('clicked', self.main.actions.on_ask_cancel_click) 
    213          
    214      
    215     def match_cb(self, completion, model, iter): 
    216         print_debug ( "match_cb() " ) 
    217         print_debug( "%s was selected" %(model[iter][0]) ) 
    218         self.main.actions.exe_app_in_client_display(model[iter][0]) 
    219         return 
    220      
    221     def activate_cb(self, entry): 
    222         text = self.main.ask_entry.get_text() 
    223         print_debug ( "activate_cb() text=%s" %(text) ) 
    224          
    225         # append to liststore 
    226         if text: 
    227             if text not in [row[0] for row in self.liststore]: 
    228                 self.liststore.append([text]) 
    229                 #self.main.ask_entry.set_text('') 
    230          
    231         # exe app         
    232         self.main.actions.exe_app_in_client_display(text) 
    233         return 
     174#    def initask(self): 
     175#        self.main.ask_ip=None 
     176#         
     177#        self.main.ask = self.main.ui.get_widget('askwindow') 
     178#        self.main.ask.connect('delete-event', self.main.actions.askwindow_close ) 
     179#        self.main.ask.set_icon_from_file(shared.IMG_DIR +'tcos-icon-32x32.png') 
     180#         
     181#         
     182#        self.main.ask_label = self.main.ui.get_widget('txt_asklabel') 
     183#        ## arrastrar y soltar 
     184#        self.main.ask_fixed = self.main.ui.get_widget('ask_fixed') 
     185#        self.main.ask_dragdrop = self.main.ui.get_widget('label99') 
     186#        self.main.image_entry = self.main.ui.get_widget('image_askentry') 
     187#        self.main.image_entry.drag_dest_set( gtk.DEST_DEFAULT_ALL, [( 'text/uri-list', 0, 2 ),], gtk.gdk.ACTION_DEFAULT | gtk.gdk.ACTION_COPY) 
     188#        self.main.image_entry.connect( 'drag_data_received', self.main.actions.on_drag_data_received) 
     189#        self.main.ask_fixed.hide() 
     190#        self.main.image_entry.hide() 
     191#        self.main.ask_dragdrop.hide() 
     192#        ## fin arrastrar y soltar 
     193#        self.liststore = gtk.ListStore(str) 
     194#        for s in shared.appslist: 
     195#            self.liststore.append([s]) 
     196#             
     197#        self.main.ask_entry = self.main.ui.get_widget('txt_askentry') 
     198#        self.main.ask_completion = gtk.EntryCompletion() 
     199#        self.main.ask_completion.set_model(self.liststore) 
     200#        self.main.ask_entry.set_completion(self.main.ask_completion) 
     201#        self.main.ask_completion.set_text_column(0) 
     202#         
     203#        self.main.ask_completion.connect('match-selected', self.match_cb) 
     204#        self.main.ask_entry.connect('activate', self.activate_cb) 
     205#         
     206#        self.main.ask_cancel = self.main.ui.get_widget('ask_cancelbutton') 
     207#        self.main.ask_exec = self.main.ui.get_widget('ask_exebutton') 
     208#         
     209#        # buttons signals 
     210#        self.main.ask_exec.connect('clicked', self.main.actions.on_ask_exec_click) 
     211#        self.main.ask_cancel.connect('clicked', self.main.actions.on_ask_cancel_click) 
     212         
     213     
     214#    def match_cb(self, completion, model, iter): 
     215#        print_debug ( "match_cb() " ) 
     216#        print_debug( "%s was selected" %(model[iter][0]) ) 
     217#        self.main.actions.exe_app_in_client_display(model[iter][0]) 
     218#        return 
     219#     
     220#    def activate_cb(self, entry): 
     221#        text = self.main.ask_entry.get_text() 
     222#        print_debug ( "activate_cb() text=%s" %(text) ) 
     223#         
     224#        # append to liststore 
     225#        if text: 
     226#            if text not in [row[0] for row in self.liststore]: 
     227#                self.liststore.append([text]) 
     228#                #self.main.ask_entry.set_text('') 
     229#         
     230#        # exe app         
     231#        self.main.actions.exe_app_in_client_display(text) 
     232#        return 
    234233     
    235234    """ 
  • trunk/tcosmonitor/Makefile

    r948 r951  
    6464        install -d $(DESTDIR)/$(PREFIX)/bin 
    6565        install -d $(DESTDIR)/$(PREFIX)/sbin 
    66         install -d $(DESTDIR)/$(TCOS_BINS) 
    6766        install -d $(DESTDIR)/etc/tcos/ 
    6867         
     
    102101        install -m 644 TcosListView.py     $(DESTDIR)/$(PREFIX)/share/$(PACKAGE)/ 
    103102        install -m 644 TcosMenus.py        $(DESTDIR)/$(PREFIX)/share/$(PACKAGE)/ 
     103        install -m 644 TcosExtensions.py   $(DESTDIR)/$(PREFIX)/share/$(PACKAGE)/ 
    104104 
    105105        install -m 755 tcosmonitor.py           $(DESTDIR)/$(PREFIX)/bin/tcosmonitor 
  • trunk/tcosmonitor/TcosActions.py

    r944 r951  
    3535import glob 
    3636 
     37from TcosExtensions import Error 
     38 
    3739COL_HOST, COL_IP, COL_USERNAME, COL_ACTIVE, COL_LOGGED, COL_BLOCKED, COL_PROCESS, COL_TIME, COL_SEL, COL_SEL_ST = range(10) 
    3840import shared 
     
    5860 
    5961    ############################################################################     
    60     def on_openvolumecontrol_button_click(self, widget, ip): 
    61         print_debug ( "on_openvolumecontrol_button_click() ip=%s" %(ip) ) 
    62         cmd="PULSE_SERVER=\"%s\" pavucontrol" %(ip) 
    63         if os.path.isdir("/dev/shm"): 
    64             self.main.common.exe_cmd( cmd, verbose=0, background=True ) 
    65         else: 
    66             shared.error_msg ( _("PulseAudio apps need /dev/shm.") ) 
    67          
    68     def on_openvolumemeter_button_click(self, widget, ip): 
    69         print_debug ( "on_openvolumemeter_button_click()  ip=%s" %(ip) ) 
    70         cmd="PULSE_SERVER=\"%s\" pavumeter" %(ip) 
    71         if os.path.isdir("/dev/shm"): 
    72             self.main.common.exe_cmd( cmd, verbose=0, background=True ) 
    73         else: 
    74             shared.error_msg ( _("PulseAudio apps need /dev/shm.") ) 
    75      
    76     def on_volumemanager_button_click(self, widget, ip): 
    77         print_debug ( "on_volumemanager_button_click() ip=%s" %(ip) ) 
    78         cmd="PULSE_SERVER=\"%s\" paman" %(ip) 
    79         if os.path.isdir("/dev/shm"): 
    80             self.main.common.exe_cmd( cmd, verbose=0, background=True ) 
    81         else: 
    82             shared.error_msg ( _("PulseAudio apps need /dev/shm.") ) 
     62#    def on_openvolumecontrol_button_click(self, widget, ip): 
     63#        print_debug ( "on_openvolumecontrol_button_click() ip=%s" %(ip) ) 
     64#        cmd="PULSE_SERVER=\"%s\" pavucontrol" %(ip) 
     65#        if os.path.isdir("/dev/shm"): 
     66#            self.main.common.exe_cmd( cmd, verbose=0, background=True ) 
     67#        else: 
     68#            shared.error_msg ( _("PulseAudio apps need /dev/shm.") ) 
     69#         
     70#    def on_openvolumemeter_button_click(self, widget, ip): 
     71#        print_debug ( "on_openvolumemeter_button_click()  ip=%s" %(ip) ) 
     72#        cmd="PULSE_SERVER=\"%s\" pavumeter" %(ip) 
     73#        if os.path.isdir("/dev/shm"): 
     74#            self.main.common.exe_cmd( cmd, verbose=0, background=True ) 
     75#        else: 
     76#            shared.error_msg ( _("PulseAudio apps need /dev/shm.") ) 
     77#     
     78#    def on_volumemanager_button_click(self, widget, ip): 
     79#        print_debug ( "on_volumemanager_button_click() ip=%s" %(ip) ) 
     80#        cmd="PULSE_SERVER=\"%s\" paman" %(ip) 
     81#        if os.path.isdir("/dev/shm"): 
     82#            self.main.common.exe_cmd( cmd, verbose=0, background=True ) 
     83#        else: 
     84#            shared.error_msg ( _("PulseAudio apps need /dev/shm.") ) 
    8385 
    8486    def on_kill_button_click(self, widget, pid, username): 
     
    106108        print_debug("on_allhostbutton_click() ....") 
    107109        event = gtk.gdk.Event(gtk.gdk.BUTTON_PRESS) 
     110        self.main.menus.RightClickMenuAll() 
    108111        self.main.allmenu.popup( None, None, None, event.button, event.time) 
    109112        return True 
     
    125128            self.main.is_fullscreen=True 
    126129            self.main.fullscreenbutton.set_stock_id("gtk-leave-fullscreen") 
    127      
    128     def on_downloadallmodules_click(self, widget): 
     130 
     131    """ 
     132#    def on_downloadallmodules_click(self, widget): 
    129133        print_debug ( "on_downloadallmodules_click() ################" ) 
    130134        if self.main.selected_ip != None: 
     
    133137            self.main.xmlrpc.Exe("useallmodules.sh") 
    134138        pass 
    135      
     139    """ 
    136140     
    137141    def on_progressbutton_click(self, widget): 
     
    219223        return self.main.updating 
    220224 
    221          
    222     def askwindow_close(self, widget, event): 
    223         print_debug ( "askwindow_close() closing ask window" ) 
    224         self.main.ask.hide() 
    225         return True 
     225#         
     226#    def askwindow_close(self, widget, event): 
     227#        print_debug ( "askwindow_close() closing ask window" ) 
     228#        self.main.ask.hide() 
     229#        return True 
    226230     
    227     def on_drag_data_received( self, widget, context, x, y, selection, targetType, dtime): 
    228         files = selection.data.split('\n',1) 
    229         start1=time() 
    230         print_debug("on_drag_data_received() files=%s dtime=%s"%(files,dtime)) 
    231         for f in files: 
    232             if f: 
    233                 desktop = f.strip().replace('%20', ' ') 
    234                 break 
    235                     
    236         if desktop.startswith('file:///') and desktop.lower().endswith('.desktop') and os.path.isfile(desktop[7:]): 
    237             print_debug("open_file() reading data from \"%s\"..." \ 
    238                         %(desktop[7:]) ) 
    239             fd=file(desktop[7:], 'r') 
    240             data=fd.readlines() 
    241             fd.close() 
    242              
    243             # try to load gnome theme with gconf 
    244             mytheme=[] 
    245             theme=self.main.common.get_icon_theme() 
    246             print_debug("on_drag_data_received() gconf theme=%s"%theme) 
    247              
    248             """ 
    249             icons_path=["/usr/share/app-install/icons/", 
    250                         "/usr/share/icons/hicolor/48x48/apps/",  
    251                         "/usr/share/icons/hicolor/32x32/apps/", 
    252                         "/usr/share/icons/hicolor/24x24/apps/",  
    253                         "/usr/share/icons/gnome/48x48/apps/", 
    254                         "/usr/share/icons/gnome/32x32/apps/",  
    255                         "/usr/share/pixmaps/", 
    256                         "/usr/share/icons/gnome/32x32/devices/"] 
    257             icons_extensions=[".png", "", ".xpm"] 
    258             """ 
    259             str_image="" 
    260             files=[] 
    261              
    262             if theme and os.path.isdir("/usr/share/icons/%s"%theme): 
    263                     files+=glob.glob("/usr/share/icons/%s/48x48/*.png"%(theme)) 
    264              
    265             files+=glob.glob("/usr/share/icons/hicolor/48x48/*/*.png") + \ 
    266                    glob.glob("/usr/share/icons/gnome/48x48/*/*.png") + \ 
    267                    glob.glob("/usr/share/pixmaps/*png") +\ 
    268                    glob.glob("/usr/share/pixmaps/*xpm") 
    269              
    270             for line in data: 
    271                 if line != '\n': 
    272                     if line.startswith("Exec="): 
    273                         line=line.replace('\n', '') 
    274                         action, str_exec=line.split("=",1) 
    275                         str_exec=str_exec.replace("%U","").replace("%u","").replace("%F","").replace("%f","").replace("%c","").replace("%i","").replace("%m","") 
    276                     elif line.startswith("Icon="): 
    277                         line=line.replace('\n', '') 
    278                         action, image_name=line.split("=",1)                         
    279                         if not os.path.isfile(image_name): 
    280                             start2=time() 
    281                             for f in files: 
    282                                 if image_name in f or image_name.replace('_', '-') in f: 
    283                                     str_image=f 
    284                                     crono(start2, "on_drag_data_received() ICON FOUND AT %s"%f ) 
    285                                     break 
    286                              
    287                             """ 
    288                             for ipath in icons_path:                     
    289                                 for ext in icons_extensions: 
    290                                     print_debug("searching icon=%s in %s extension=%s" %(image_name, ipath, ext)) 
    291                                     if os.path.isfile(ipath+image_name+ext): 
    292                                         str_image=ipath+image_name+ext 
    293                                         print_debug("image_name=%s found at %s, extension %s" %(image_name, ipath, ext)) 
    294                                         break 
    295                                 if str_image != "": break 
    296                                 str_image="" 
    297                             """ 
    298                         else: 
    299                             str_image=image_name 
    300                                      
    301             if len(str_exec) <1: 
    302                 shared.error_msg( _("%s is not application") %(os.path.basename(desktop[7:])) ) 
    303             else: 
    304                 if len(str_image) <1: 
    305                     print_debug("on_drag_data_received() image '%s' not found"%image_name) 
    306                     self.main.image_entry.set_from_stock(gtk.STOCK_DIALOG_QUESTION, 4) 
    307                 else: 
    308                     self.main.image_entry.set_from_file(str_image) 
    309                 self.main.ask_entry.set_text(str_exec) 
    310         else: 
    311             shared.error_msg( _("%s is not application") %(os.path.basename(desktop[7:])) ) 
    312         crono(start1, "on_drag_data_received() end" ) 
    313         return True 
     231#    def on_drag_data_received( self, widget, context, x, y, selection, targetType, dtime): 
     232#        files = selection.data.split('\n',1) 
     233#        start1=time() 
     234#        print_debug("on_drag_data_received() files=%s dtime=%s"%(files,dtime)) 
     235#        for f in files: 
     236#            if f: 
     237#                desktop = f.strip().replace('%20', ' ') 
     238#                break 
     239#                    
     240#        if desktop.startswith('file:///') and desktop.lower().endswith('.desktop') and os.path.isfile(desktop[7:]): 
     241#            print_debug("open_file() reading data from \"%s\"..." \ 
     242#                        %(desktop[7:]) ) 
     243#            fd=file(desktop[7:], 'r') 
     244#            data=fd.readlines() 
     245#            fd.close() 
     246#             
     247#            # try to load gnome theme with gconf 
     248#            mytheme=[] 
     249#            theme=self.main.common.get_icon_theme() 
     250#            print_debug("on_drag_data_received() gconf theme=%s"%theme) 
     251#             
     252#            """ 
     253#            icons_path=["/usr/share/app-install/icons/", 
     254#                        "/usr/share/icons/hicolor/48x48/apps/",  
     255#                        "/usr/share/icons/hicolor/32x32/apps/", 
     256#                        "/usr/share/icons/hicolor/24x24/apps/",  
     257#                        "/usr/share/icons/gnome/48x48/apps/", 
     258#                        "/usr/share/icons/gnome/32x32/apps/",  
     259#                        "/usr/share/pixmaps/", 
     260#                        "/usr/share/icons/gnome/32x32/devices/"] 
     261#            icons_extensions=[".png", "", ".xpm"] 
     262#            """ 
     263#            str_image="" 
     264#            files=[] 
     265#             
     266#            if theme and os.path.isdir("/usr/share/icons/%s"%theme): 
     267#                    files+=glob.glob("/usr/share/icons/%s/48x48/*.png"%(theme)) 
     268#             
     269#            files+=glob.glob("/usr/share/icons/hicolor/48x48/*/*.png") + \ 
     270#                   glob.glob("/usr/share/icons/gnome/48x48/*/*.png") + \ 
     271#                   glob.glob("/usr/share/pixmaps/*png") +\ 
     272#                   glob.glob("/usr/share/pixmaps/*xpm") 
     273#             
     274#            for line in data: 
     275#                if line != '\n': 
     276#                    if line.startswith("Exec="): 
     277#                        line=line.replace('\n', '') 
     278#                        action, str_exec=line.split("=",1) 
     279#                        str_exec=str_exec.replace("%U","").replace("%u","").replace("%F","").replace("%f","").replace("%c","").replace("%i","").replace("%m","") 
     280#                    elif line.startswith("Icon="): 
     281#                        line=line.replace('\n', '') 
     282#                        action, image_name=line.split("=",1)                         
     283#                        if not os.path.isfile(image_name): 
     284#                            start2=time() 
     285#                            for f in files: 
     286#                                if image_name in f or image_name.replace('_', '-') in f: 
     287#                                    str_image=f 
     288#                                    crono(start2, "on_drag_data_received() ICON FOUND AT %s"%f ) 
     289#                                    break 
     290#                             
     291#                            """ 
     292#                            for ipath in icons_path:                     
     293#                                for ext in icons_extensions: 
     294#                                    print_debug("searching icon=%s in %s extension=%s" %(image_name, ipath, ext)) 
     295#                                    if os.path.isfile(ipath+image_name+ext): 
     296#                                        str_image=ipath+image_name+ext 
     297#                                        print_debug("image_name=%s found at %s, extension %s" %(image_name, ipath, ext)) 
     298#                                        break 
     299#                                if str_image != "": break 
     300#                                str_image="" 
     301#                            """ 
     302#                        else: 
     303#                            str_image=image_name 
     304#                                     
     305#            if len(str_exec) <1: 
     306#                shared.error_msg( _("%s is not application") %(os.path.basename(desktop[7:])) ) 
     307#            else: 
     308#                if len(str_image) <1: 
     309#                    print_debug("on_drag_data_received() image '%s' not found"%image_name) 
     310#                    self.main.image_entry.set_from_stock(gtk.STOCK_DIALOG_QUESTION, 4) 
     311#                else: 
     312#                    self.main.image_entry.set_from_file(str_image) 
     313#                self.main.ask_entry.set_text(str_exec) 
     314#        else: 
     315#            shared.error_msg( _("%s is not application") %(os.path.basename(desktop[7:])) ) 
     316#        crono(start1, "on_drag_data_received() end" ) 
     317#        return True 
    314318     
    315     def on_ask_exec_click(self, widget): 
    316         app=self.main.ask_entry.get_text() 
    317         if app != "": 
    318             self.exe_app_in_client_display(app) 
    319         return 
     319#    def on_ask_exec_click(self, widget): 
     320#        app=self.main.ask_entry.get_text() 
     321#        if app != "": 
     322#            self.exe_app_in_client_display(app) 
     323#        return 
     324#     
     325#    def on_ask_cancel_click(self, widget): 
     326#        self.main.ask.hide() 
     327#        self.main.ask_entry.set_text("") 
     328#        #desactivar arrastrar y soltar 
     329#        self.main.ask_fixed.hide() 
     330#        self.main.image_entry.hide() 
     331#        self.main.ask_dragdrop.hide() 
     332#        return 
    320333     
    321     def on_ask_cancel_click(self, widget): 
    322         self.main.ask.hide() 
    323         self.main.ask_entry.set_text("") 
    324         #desactivar arrastrar y soltar 
    325         self.main.ask_fixed.hide() 
    326         self.main.image_entry.hide() 
    327         self.main.ask_dragdrop.hide() 
    328         return 
     334#    def askfor(self, mode="mess", msg="", users=[]): 
     335#        self.ask_usernames=[] 
     336#        if len(users) == 0 or users[0] == shared.NO_LOGIN_MSG: 
     337#            shared.error_msg( _("Clients not connected") ) 
     338#            return 
     339#        else: 
     340#            self.ask_usernames=users 
     341 
     342#        users_txt="" 
     343#        counter=1 
     344#        for user in self.ask_usernames: 
     345#            users_txt+="%s, " %(user) 
     346#            print_debug("askfor() counter=%s" %(counter) ) 
     347#            if counter % 4 == 0: 
     348#                users_txt+="\n" 
     349#            counter=int(counter+1) 
     350 
     351#        if users_txt[-2:] == "\n": users_txt=users_txt[:-2] 
     352#        if users_txt[-2:] == ", ": users_txt=users_txt[:-2] 
     353#         
     354#        if mode == "exec": 
     355#            #activar arrastrar y soltar 
     356#            self.main.ask_fixed.show() 
     357#            self.main.ask_dragdrop.show() 
     358#            self.main.image_entry.show() 
     359#            self.main.image_entry.set_from_stock(gtk.STOCK_DIALOG_QUESTION, 4) 
     360#            self.main.ask_label.set_markup( _("<b>Exec app in user(s) screen(s):</b>\n%s" ) %( users_txt ) ) 
     361#        elif mode == "mess": 
     362#            self.main.ask_label.set_markup( _("<b>Send a message to:</b>\n%s" ) %( users_txt ) ) 
     363#        elif mode == "any": 
     364#            self.main.ask_label.set_markup( msg ) 
     365#        self.ask_mode=mode 
     366#        self.main.ask.show() 
     367#        return True 
     368                 
     369#    def exe_app_in_client(self, mode, timeout=0, msg="", users=[], connected_users=[]): 
     370#        remote_cmd=("/usr/lib/tcos/session-cmd-send %s %s %s" %(mode.upper(), timeout, msg.replace("'", "´"))) 
     371#        action="down-controller %s %s" %(mode, timeout) 
     372#        print_debug("exe_app_in_client() usernames=%s" %users) 
     373#         
     374#        if len(connected_users) != 0 and connected_users[0] != shared.NO_LOGIN_MSG: 
     375#            newusernames=[] 
     376#            for user in connected_users: 
     377#                if user.find(":") != -1: 
     378#                    # we have a standalone user... 
     379#                    usern, ip = user.split(":") 
     380#                    self.main.xmlrpc.newhost(ip) 
     381#                    self.main.xmlrpc.DBus("exec", remote_cmd ) 
     382#                else: 
     383#                    newusernames.append(user) 
     384#                                 
     385#            result = self.main.dbus_action.do_exec( newusernames ,remote_cmd ) 
     386#                 
     387#            if not result: 
     388#                shared.error_msg ( _("Error while exec remote app:\nReason:%s") %( self.main.dbus_action.get_error_msg() ) ) 
     389#         
     390#        self.main.worker=shared.Workers(self.main, None, None) 
     391#        self.main.worker.set_for_all_action(self.action_for_clients,\ 
     392#                                                     users, action ) 
     393#        return 
    329394     
    330     def askfor(self, mode="mess", msg="", users=[]): 
    331         self.ask_usernames=[] 
    332         if len(users) == 0 or users[0] == shared.NO_LOGIN_MSG: 
    333             shared.error_msg( _("Clients not connected") ) 
    334             return 
    335         else: 
    336             self.ask_usernames=users 
    337  
    338         users_txt="" 
    339         counter=1 
    340         for user in self.ask_usernames: 
    341             users_txt+="%s, " %(user) 
    342             print_debug("askfor() counter=%s" %(counter) ) 
    343             if counter % 4 == 0: 
    344                 users_txt+="\n" 
    345             counter=int(counter+1) 
    346  
    347         if users_txt[-2:] == "\n": users_txt=users_txt[:-2] 
    348         if users_txt[-2:] == ", ": users_txt=users_txt[:-2] 
    349          
    350         if mode == "exec": 
    351             #activar arrastrar y soltar 
    352             self.main.ask_fixed.show() 
    353             self.main.ask_dragdrop.show() 
    354             self.main.image_entry.show() 
    355             self.main.image_entry.set_from_stock(gtk.STOCK_DIALOG_QUESTION, 4) 
    356             self.main.ask_label.set_markup( _("<b>Exec app in user(s) screen(s):</b>\n%s" ) %( users_txt ) ) 
    357         elif mode == "mess": 
    358             self.main.ask_label.set_markup( _("<b>Send a message to:</b>\n%s" ) %( users_txt ) ) 
    359         elif mode == "any": 
    360             self.main.ask_label.set_markup( msg ) 
    361         self.ask_mode=mode 
    362         self.main.ask.show() 
    363         return True 
    364                  
    365     def exe_app_in_client(self, mode, timeout=0, msg="", users=[], connected_users=[]): 
    366         remote_cmd=("/usr/lib/tcos/session-cmd-send %s %s %s" %(mode.upper(), timeout, msg.replace("'", "´"))) 
    367         action="down-controller %s %s" %(mode, timeout) 
    368         print_debug("exe_app_in_client() usernames=%s" %users) 
    369          
    370         if len(connected_users) != 0 and connected_users[0] != shared.NO_LOGIN_MSG: 
    371             newusernames=[] 
    372             for user in connected_users: 
    373                 if user.find(":") != -1: 
    374                     # we have a standalone user... 
    375                     usern, ip = user.split(":") 
    376                     self.main.xmlrpc.newhost(ip) 
    377                     self.main.xmlrpc.DBus("exec", remote_cmd ) 
    378                 else: 
    379                     newusernames.append(user) 
    380                                  
    381             result = self.main.dbus_action.do_exec( newusernames ,remote_cmd ) 
    382                  
    383             if not result: 
    384                 shared.error_msg ( _("Error while exec remote app:\nReason:%s") %( self.main.dbus_action.get_error_msg() ) ) 
    385          
    386         self.main.worker=shared.Workers(self.main, None, None) 
    387         self.main.worker.set_for_all_action(self.action_for_clients,\ 
    388                                                      users, action ) 
    389         return 
    390      
    391     def exe_app_in_client_display(self, arg): 
    392         usernames=self.ask_usernames 
    393         newusernames=[] 
    394         print_debug("exe_app_in_client_display() usernames=%s" %usernames) 
    395