Esempio n. 1
0
 def openconf(self, *args):
     """ Open config file in default text editor """
     checkconfig.checkconfig(CONFIG)
     if os.path.isfile('/usr/bin/gedit'):
         tmppid = procman.startprocess(['gedit', CONFIG])
     elif os.path.isfile('/usr/bin/mousepad'):
         tmppid = procman.startprocess(['mousepad', CONFIG])
     elif os.path.isfile('/usr/bin/xdg-open'):
         tmppid = procman.startprocess(['xdg-open', CONFIG])
     if tmppid:
         self.hide()
Esempio n. 2
0
 def execute(self, actor, event):
     """ Execute commands in a subprocess """
     tmppid = None
     if event:
         if Gdk.ModifierType.BUTTON1_MASK == event.get_state():
             tmpcount = 0
             for items in self.favlist:
                 if actor == items[0]:
                     # find existing process
                     if isinstance(items[3], int):
                         tmppid = self.activatepid(items[3])
                         if tmppid:
                             logops.write(LOGFILE, ('PIRUM: found running ' +
                                                    'pid\n     Command: ' +
                                                    str(items[1]) +
                                                    '\n     PID: ' +
                                                    str(items[3]) + '\n'))
                             self.hide()
                             return True
                 tmpcount = tmpcount + 1
             tmpcount = 0
             for items in self.favlist:
                 if actor == items[0]:
                     # Switch to active windows
                     if self.changewindow(items[0], event):
                         logops.write(LOGFILE,
                                      ('PIRUM: activate existing window\n  ' +
                                       '   ' + items[0].get_tooltip_text()))
                         self.hide()
                         return True
                     tmpexec = (items[1]).split()
                     if not tmpexec:
                         tmpexec = [].append(items[1])
                     tmppid = procman.startprocess(tmpexec)
                     if tmppid:
                         logops.write(LOGFILE,
                                      ('PIRUM: executing favourite\n' +
                                       '     CMD: ' + str(items[1]) +
                                       '\n     PID: ' + str(tmppid[0]) +
                                       '\n'))
                         self.setpid(tmppid[0], tmpcount)
                         self.hide()
                         return True
                 tmpcount = tmpcount + 1
     if actor == "enter" or actor == self.gobutton:
         logops.write(LOGFILE, ('PIRUM: executing from runentry\n     ' +
                                self.runentry.get_text() + '\n'))
         runcmd = str.split(self.runentry.get_text())
         tmppid = procman.startprocess(runcmd)
         self.runentry.set_text("")
     if tmppid:
         self.hide()
     return
Esempio n. 3
0
 def sessionman(self, actor):
     """ session management processes """
     if actor == self.logoutbutton:
         tmppid = procman.startprocess(['gnome-session-quit',
                                        '--logout', '--force'])
     elif actor == self.restartbutton:
         tmppid = procman.startprocess(['gnome-session-quit',
                                        '--reboot'])
     elif actor == self.haltbutton:
         tmppid = procman.startprocess(['gnome-session-quit',
                                        '--power-off'])
     if tmppid:
         self.hide()
     return
Esempio n. 4
0
 def run(self, *args):
     """ configure and show the main window """
     #format windows
     windowlist = [self.mainwindow, self.topdock, self.hotwin]
     # make windows undecorated and set options
     for windows in windowlist:
         windows.set_decorated(False)
         windows.set_decorated(False)
         windows.set_skip_taskbar_hint(True)
         windows.set_skip_pager_hint(True)
         windows.set_keep_above(True)
     self.hotwin.move(0, 0)
     self.hotwin.set_position(Gtk.Align.START)
     if args:
         # only run autostart on initial run
         if args[0] == 'START':
             # write the start of the log
             logops.write(LOGFILE, ('\n================================' +
                                    '===\nSTARTUP: pirum-shell is loading' +
                                    '...\n' + time.asctime() +
                                    '\nWriting to log file: ' + LOGFILE +
                                    '\n================================' +
                                    '===\n'))
             # run autostart commands
             if self.autostart:
                 self.autostart = self.autostart.split("    ")
                 for items in self.autostart:
                     # execute autorun programs as hidden shell commands
                     tmpexec = items.split()
                     if tmpexec:
                         logops.write(LOGFILE, 'PIRUM: executing aut' +
                                      'ostart\n   Command: ' + items + '\n')
                         tmppid = procman.startprocess(tmpexec)
                     if tmppid:
                         self.autostartpids.append(tmppid)
     # Check config files and load favourites.
     self.updatefavdock()
     self.updateopenwindows()
     # set visual options.
     self.initialloading()
     self.hotwin.show()
     self.mainwindow.hide()
     self.topdock.hide()
     return