fix indentation bug in add_execute_suggestions, some coding style

This commit is contained in:
gm10 2019-02-13 16:35:53 +01:00
parent 5276fa49ec
commit 4d1687c5c1
No known key found for this signature in database
GPG Key ID: A981D4EA8CF993A9
2 changed files with 18 additions and 16 deletions

View File

@ -654,13 +654,16 @@ class pluginclass(object):
return
commands = user_text.split()
cmd = self.verify_command(commands[0])
if cmd:
if not cmd:
return
text = "<b>%s</b>" % cgi.escape(text)
commands[0] = cmd
if cmd.startswith("xdg-open"):
self.add_suggestion("document-open", _("Try to open %s") % text, None, self.execute_user_input, commands, False)
self.add_suggestion("document-open", _("Try to open %s") % text,
None, self.execute_user_input, commands, False)
else:
self.add_suggestion("application-x-executable", _("Run %s") % text, None, self.execute_user_input, commands, False)
self.add_suggestion("application-x-executable", _("Run %s") % text,
None, self.execute_user_input, commands, False)
self.applicationsBox.get_children()[-1].grab_focus()
def add_apt_filter_results(self, keyword):
@ -1088,8 +1091,7 @@ class pluginclass(object):
IntegratedTerminal(command,
_("mintMenu Integrated Terminal"),
width=self.integrated_terminal_width,
height=self.integrated_terminal_height
)
height=self.integrated_terminal_height)
except Exception as e:
print("IntegratedTerminal exception:", e)
hasVte = False

View File

@ -20,8 +20,8 @@ class IntegratedTerminal(Gtk.Window):
self.ready = False
self.output_handler = self.terminal.connect("cursor-moved",
self.on_cursor_moved)
# apparently Vte.Terminal.spawn_sync() is deprecated in favour of the
# non-existent Vte.Terminal.spawn_async()...
# apparently Vte.Terminal.spawn_sync() is deprecated in favour of
# the non-existent Vte.Terminal.spawn_async()...
self.terminal.spawn_sync(
Vte.PtyFlags.DEFAULT, # pty_flags
cwd or os.environ.get("HOME"), # working_directory
@ -81,11 +81,11 @@ class IntegratedTerminal(Gtk.Window):
if not line.lstrip(prefix):
# we got a command prompt, exit
self.exit()
break
return
# the command generated output, show the terminal
terminal.disconnect(self.output_handler)
self.show_all()
break
return
if self.command in line:
# this is our command line
prefix = line.split(self.command, 1)[0]