def start(self): """ Starts driver test subprocess """ cmd = [find_binary("scc")] + ["test_" + self.driver, self.device_id] self.subprocess = Gio.Subprocess.new(cmd, Gio.SubprocessFlags.STDOUT_PIPE) self.subprocess.wait_async(None, self._on_finished) self.subprocess.get_stdout_pipe().read_bytes_async( 32, 0, None, self._on_read)
def check(self): """ Performs various (three) checks and reports possible problems """ # TODO: Maybe not best place to do this try: # Dynamic modules rawlist = file("/proc/modules", "r").read().split("\n") kernel_mods = [ line.split(" ")[0] for line in rawlist ] # Built-in modules release = platform.uname()[2] rawlist = file("/lib/modules/%s/modules.builtin" % release, "r").read().split("\n") kernel_mods += [ os.path.split(x)[-1].split(".")[0] for x in rawlist ] except Exception: # Maybe running on BSD or Windows... kernel_mods = [ ] if len(kernel_mods) > 0 and "uinput" not in kernel_mods: # There is no uinput msg = _('uinput kernel module not loaded') msg += "\n\n" + _('Please, consult your distribution manual on how to enable uinput') msg += "\n" + _('or click on "Fix Temporary" button to attempt fix that should work until next restart.') ribar = self.show_error(msg) gksudo = find_gksudo() modprobe = find_binary("modprobe") if gksudo and not hasattr(ribar, "_fix_tmp"): button = Gtk.Button.new_with_label(_("Fix Temporary")) ribar._fix_tmp = button button.connect('clicked', self.apply_temporary_fix, gksudo + [modprobe, "uinput"], _("This will load missing uinput module.") ) ribar.add_button(button, -1) return True elif not os.path.exists("/dev/uinput"): # /dev/uinput missing msg = _('/dev/uinput doesn\'t exists') msg += "\n" + _('uinput kernel module is loaded, but /dev/uinput is missing.') #msg += "\n\n" + _('Please, consult your distribution manual on what in the world could cause this.') msg += "\n\n" + _('Please, consult your distribution manual on how to enable uinput') self.show_error(msg) return True elif not check_access("/dev/uinput"): # Cannot acces uinput msg = _('You don\'t have required access to /dev/uinput.') msg += "\n" + _('This will most likely prevent emulation from working.') msg += "\n\n" + _('Please, consult your distribution manual on how to enable uinput') msg += "\n" + _('or click on "Fix Temporary" button to attempt fix that should work until next restart.') ribar = self.show_error(msg) gksudo = find_gksudo() if gksudo and not hasattr(ribar, "_fix_tmp"): button = Gtk.Button.new_with_label(_("Fix Temporary")) ribar._fix_tmp = button button.connect('clicked', self.apply_temporary_fix, gksudo + ["chmod", "666", "/dev/uinput"], _("This will enable input emulation for <i>every application</i> and <i>all users</i> on this machine.") ) ribar.add_button(button, -1) return True return False
def start(self, mode="start"): """ Starts the daemon and forces connection to be created immediately. """ if self.alive: # Just to clean up living connection self.alive = None self._on_daemon_died() Gio.Subprocess.new([ find_binary('scc-daemon'), "/dev/null", mode ], Gio.SubprocessFlags.NONE) self._connect()
def start(self, mode="start"): """ Starts the daemon and forces connection to be created immediately. """ if self.alive: # Just to clean up living connection self.alive = None self._on_daemon_died() Gio.Subprocess.new([ find_binary('scc-daemon'), "/dev/null", mode ], Gio.SubprocessFlags.NONE) self._connect()
""" See above. This method just parses Default menu and checks boxes for present menu items. """ try: data = MenuData.from_fileobj(open(find_menu("Default.menu"), "r")) except Exception, e: # Shouldn't really happen log.error(traceback.format_exc()) return self._recursing = True for index in xrange(0, len(GlobalSettings.DEFAULT_MENU_OPTIONS)): id = "cbMI_%s" % (index, ) instance = GlobalSettings._make_mi_instance(index) present = (instance.describe().strip(" >") in [x.describe().strip(" >") for x in data]) self.builder.get_object(id).set_active(present) # cbMI_5, 'Kill Current Window' is special case here. This checkbox # should be available only if xdotool utility is installed. cbMI_5 = self.builder.get_object("cbMI_5") if find_binary("xdotool") == "xdotool": # Not found cbMI_5.set_sensitive(False) cbMI_5.set_tooltip_text( _("Please, install xdotool package to use this feature")) else: cbMI_5.set_sensitive(True) cbMI_5.set_tooltip_text("")
def help_gui(): scc_daemon = find_binary("sc-controller") subprocess.Popen([scc_daemon, "--help"]).communicate()
def cmd_gui(argv0, argv): """ Starts GUI """ # Passes parameters to sc-controller scc_daemon = find_binary("sc-controller") subprocess.Popen([scc_daemon] + argv).communicate()
def help_daemon(): scc_daemon = find_binary("scc-daemon") subprocess.Popen([scc_daemon, "--help"]).communicate()
def cmd_daemon(argv0, argv): """ Controls scc-daemon """ # Actually just passes parameters to scc-daemon scc_daemon = find_binary("scc-daemon") subprocess.Popen([scc_daemon] + argv).communicate()
def stop(self): """ Stops the daemon """ Gio.Subprocess.new([ find_binary('scc-daemon'), "/dev/null", "stop" ], Gio.SubprocessFlags.NONE)
def stop(self): """ Stops the daemon """ Gio.Subprocess.new([find_binary('scc-daemon'), "/dev/null", "stop"], Gio.SubprocessFlags.NONE)
def help_gui(): scc_daemon = find_binary("sc-controller") subprocess.Popen([scc_daemon, "--help"]).communicate()
def cmd_gui(argv0, argv): """ Starts GUI """ # Passes parameters to sc-controller scc_daemon = find_binary("sc-controller") subprocess.Popen([scc_daemon] + argv).communicate()
def help_daemon(): scc_daemon = find_binary("scc-daemon") subprocess.Popen([scc_daemon, "--help"]).communicate()
def cmd_daemon(argv0, argv): """ Controls scc-daemon """ # Actually just passes parameters to scc-daemon scc_daemon = find_binary("scc-daemon") subprocess.Popen([scc_daemon] + argv).communicate()