initial commit for remotinator background image command
This commit is contained in:
parent
b4990c3c24
commit
0434880f13
@ -47,6 +47,7 @@ COMMANDS={
|
||||
'get_tab': [True, _('Get the UUID of a parent tab')],
|
||||
'get_tab_title': [True, _('Get the title of a parent tab')],
|
||||
'set_tab_title': [True, _('Set the title of a parent tab')],
|
||||
'bg_img': [True, _('Set the background image')].
|
||||
'switch_profile': [True, _('Switch current terminal profile')],
|
||||
'switch_profile_all': [False, _('Switch profile of all currently running terminals')],
|
||||
}
|
||||
@ -77,6 +78,9 @@ if __name__ == '__main__':
|
||||
parser.add_argument('-p', '--profile', dest='profile', type=str, default=argparse.SUPPRESS,
|
||||
help=_('Terminal UUID for when not in env var TERMINATOR_UUID'))
|
||||
|
||||
parser.add_argument('-f', '--file', dest='file', type=str, default=argparse.SUPPRESS,
|
||||
help=_('File to pass to command'))
|
||||
|
||||
parser.add_argument('-x', '--execute', dest='execute', type=str, default=argparse.SUPPRESS,
|
||||
help=_('Terminal UUID for when not in env var TERMINATOR_UUID'))
|
||||
|
||||
|
@ -124,6 +124,16 @@ class DBusService(Borg, dbus.service.Object):
|
||||
"""Create a new tab"""
|
||||
return self.new_terminal(uuid, 'tab')
|
||||
|
||||
@dbus.service.method(BUS_NAME)
|
||||
def bg_img(self,uuid=None,options=None):
|
||||
terminals = []
|
||||
if uuid:
|
||||
terminals.append(self.terminator.find_terminal_by_uuid(uuid))
|
||||
else:
|
||||
terminals = self.get_terminals()
|
||||
for terminal in terminals:
|
||||
terminal.set_background_image(options.get('file'))
|
||||
|
||||
@dbus.service.method(BUS_NAME)
|
||||
def hsplit(self, uuid=None,options=None):
|
||||
"""Split a terminal horizontally, by UUID"""
|
||||
@ -422,3 +432,7 @@ def switch_profile(session, uuid, options):
|
||||
def switch_profile_all(session,options):
|
||||
"""Call the dbus method to return the title of a tab"""
|
||||
session.switch_profile_all(options)
|
||||
|
||||
@with_proxy
|
||||
def bg_img(session,uuid,options):
|
||||
session.bg_img(uuid,options)
|
||||
|
@ -203,6 +203,16 @@ class Terminal(Gtk.VBox):
|
||||
self.reconfigure()
|
||||
self.vte.set_size(80, 24)
|
||||
|
||||
def set_background_image(self,image):
|
||||
try:
|
||||
self.background_image = GdkPixbuf.Pixbuf.new_from_file(image)
|
||||
self.vte.set_clear_background(False)
|
||||
self.vte.connect("draw",self.background_draw)
|
||||
except Exception as e:
|
||||
self.background_image = None
|
||||
self.vte.set_clear_background(True)
|
||||
err('error loading background image: %s, %s' % (type(e).__name__,e))
|
||||
|
||||
def get_vte(self):
|
||||
"""This simply returns the vte widget we are using"""
|
||||
return(self.vte)
|
||||
|
Loading…
Reference in New Issue
Block a user