예제 #1
0
    def __init__(sfelf, handle):
        import gtk, pango, vte
        super(VteActivity, self).__init__(handle)
        toolbox = activity.ActivityToolbox(self)
        self.set_toolbox(toolbox)
        toolbox.show()

        # creates vte widget
        self._vte = vte.Terminal()
        self._vte.set_size(30, 5)
        self._vte.set_size_request(200, 300)
        font = 'Monospace 10'
        self._vte.set_font(pango.FontDescription(font))
        self._vte.set_colors(gtk.gdk.color_parse('#000000'),
                             gtk.gdk.color_parse('#E7E7E7'), [])
        # ...and its scrollbar
        vtebox = gtk.HBox()
        vtebox.pack_start(self._vte)
        vtesb = gtk.VScrollbar(self._vte.get_adjustment())
        vtesb.show()
        vtebox.pack_start(vtesb, False, False, 0)
        self.set_canvas(vtebox)
        self.show_all()

        # now start subprocess.
        self._vte.grab_focus()
        bundle_path = activity.get_bundle_path()
        # the 'sleep 1' works around a bug with the command dying before
        # the vte widget manages to snarf the last bits of its output
        self._pid = self._vte.fork_command \
                    (command='/bin/sh',
                     argv=['/bin/sh','-c',
                           'python %s/pippy_app.py; sleep 1' % bundle_path],
                     envv=["PYTHONPATH=%s/library" % bundle_path],
                     directory=bundle_path)
예제 #2
0
def vte_con(ct, ttynum):
    print("Doing console in a VTE widget...")
    masterfd = ct.console_getfd(ttynum)
    term = vte.Terminal()
    term.set_cursor_blinks(True)
    term.set_scrollback_lines(1000)
    term.connect('eof', gtk_exit_cb)

    term.set_pty(masterfd)
    term.feed_child('\n')
    #term.feed_child('ps aux\n')

    vscrollbar = gtk.VScrollbar()
    vscrollbar.set_adjustment(term.get_adjustment())

    hbox = gtk.HBox()
    hbox.pack_start(term)
    hbox.pack_start(vscrollbar)

    window = gtk.Window()
    window.add(hbox)
    window.connect('delete-event', lambda window, event: gtk.main_quit())
    window.show_all()
    gtk.main()
    print("Console done")
예제 #3
0
    def __init__(self):
        super(TerminalWidget, self).__init__()
        self.__termbox = gtk.HBox()
        self.add(self.__termbox)

        try:
            import vte

            self.term = vte.Terminal()
            self.term.fork_command()
            self.term.connect('child-exited',
                              lambda *w: self.term.fork_command())

            self.__scroll = gtk.VScrollbar(self.term.get_adjustment())
            border = gtk.Frame()
            border.set_shadow_type(gtk.SHADOW_ETCHED_IN)
            border.add(self.term)

            self.__termbox.pack_start(border)
            self.__termbox.pack_start(self.__scroll, False)

            self.term.set_size_request(0, 0)
        except ImportError:
            label = gtk.Label(
                _("<b>Loser!</b> You don't have vte python bindings installed.\n" \
                "Download it from <tt>http://ftp.acc.umu.se/pub/GNOME/sources/vte/</tt>")
            )

            label.set_use_markup(True)
            label.set_selectable(True)

            self.__termbox.pack_start(label)

        self.show_all()
예제 #4
0
    def init_sub_win(self):

        self.builder2 = gtk.Builder()
        self.builder2.add_from_file("./glade/gui2.glade")

        self.sub_win = self.builder2.get_object('window1')
        self.sub_win.connect('destroy', self.on_sub_win_closed)
        self.sub_win.set_title('UCloner')
        #self.sub_win.set_icon_from_file('ucloner.png')
        self.sub_win.set_position(gtk.WIN_POS_CENTER)
        self.sub_win.set_resizable(True)

        self.vte1 = vte.Terminal()
        self.vte1.set_size_request(600, 380)
        self.vte1.connect("child-exited", self.on_vte_exit, None)

        scrollbar = gtk.VScrollbar()
        adjustment = self.vte1.get_adjustment()
        scrollbar.set_adjustment(adjustment)

        hbox_vte = self.builder2.get_object('hbox_vte')
        hbox_vte.pack_start(self.vte1)
        hbox_vte.pack_start(scrollbar, expand=False)

        self.button_stop_task = self.builder2.get_object('button_stop_task')
        self.button_stop_task.connect('clicked', self.stop_task)

        self.sub_win.show_all()
예제 #5
0
    def addHost(self, host):
        def handle_copy_paste(widget, event):
            self.EntryBox.props.buffer.delete_text(0, -1)
            # check for paste key shortcut (ctl-shift-v)
            if (event.type == gtk.gdk.KEY_PRESS) \
            and (event.state & gtk.gdk.CONTROL_MASK == gtk.gdk.CONTROL_MASK) \
            and (event.state & gtk.gdk.SHIFT_MASK == gtk.gdk.SHIFT_MASK) \
            and (event.keyval == gtk.gdk.keyval_from_name('V')):
                widget.paste_clipboard()
                return True
            elif (event.type == gtk.gdk.KEY_PRESS) \
            and (event.state & gtk.gdk.CONTROL_MASK == gtk.gdk.CONTROL_MASK) \
            and (event.state & gtk.gdk.SHIFT_MASK == gtk.gdk.SHIFT_MASK) \
            and (event.keyval == gtk.gdk.keyval_from_name('C')):
                widget.copy_clipboard()
                return True

        terminal = vte.Terminal()
        # TODO: disable only this terminal widget on child exit
        # v.connect("child-exited", lambda term: gtk.main_quit())
        cmd_str = self.ssh_cmd
        if self.ssh_args is not None:
            cmd_str += " " + self.ssh_args
        cmd_str += " " + host
        cmd = cmd_str.split(' ')
        terminal.fork_command(command=cmd[0], argv=cmd)
        # track whether we mirror output to this terminal
        terminal.copy_input = True
        # attach copy/paste handler
        terminal.connect("key_press_event", handle_copy_paste)
        self.Terminals[host] = terminal
        # hook terminals so they reflow layout on exit
        self.Terminals[host].connect("child-exited", self.removeTerminal)
예제 #6
0
    def test_soft_newlines(self):
        terminal = vte.Terminal()
        terminal.set_size(10, 10)
        console = VTEConsole(terminal)
        console.width = 10
        console.height = 10
        console.prepare()

        # Check that a soft newline occurs.
        console.refresh(["0123456789",
                         "abcdefg"], (0, 0))
        self.assertEquals(get_vte_text(terminal),
                          "0123456789abcdefg" + "\n" * 9)

        # Check switching from soft newline to hard newline.
        # The chars "89" should disappear from the display.
        console.refresh(["01234567",
                         "abcdefg"], (0, 0))
        self.assertEquals(get_vte_text(terminal),
                          "01234567\nabcdefg" + "\n" * 9)

        # Test shortening the last line.
        console.refresh(["0123456789",
                         "abcd"], (0, 0))
        self.assertEquals(get_vte_text(terminal),
                          "0123456789abcd" + "\n" * 9)
예제 #7
0
    def test_soft_newlines_positioning(self):
        terminal = vte.Terminal()
        terminal.set_size(10, 10)
        console = VTEConsole(terminal)
        console.width = 10
        console.height = 10
        console.prepare()
        # Check that positioning is correct when starting from the
        # middle of the terminal.
        terminal.feed("\n\n")

        console.refresh(["012345678"], (0, 0))
        self.assertEquals(get_vte_text(terminal),
                          "\n\n012345678" + "\n" * 8)
        self.assertEquals(terminal.get_cursor_position(), (0, 2))

        # pyrepl's Reader produces empty lines.
        console.refresh(["0123456789", ""], (0, 0))
        self.assertEquals(get_vte_text(terminal),
                          "\n\n0123456789" + "\n" * 8)
        self.assertEquals(terminal.get_cursor_position(), (0, 2))

        console.refresh(["0123456789", "a"], (0, 0))
        self.assertEquals(get_vte_text(terminal),
                          "\n\n0123456789a" + "\n" * 7)
        self.assertEquals(terminal.get_cursor_position(), (0, 2))
예제 #8
0
    def __linux_plastex(command_line):
        try:
            import gtk
        except:
            print "You need to install the python gtk bindings"
            sys.exit(1)

        # import vte
        try:
            import vte
        except:
            error = gtk.MessageDialog(
                None, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK,
                'You need to install python bindings for libvte')
            print error

        command_line += 'read ; exit \n'
        v = vte.Terminal()
        v.connect("child-exited", lambda term: window.destroy())
        v.fork_command()
        v.feed_child(command_line)
        window = gtk.Window()
        window.add(v)
        window.connect('delete-event', lambda window, event: gtk.main_quit())
        window.connect('destroy', lambda window: gtk.main_quit())
        window.show_all()
        gtk.main()
예제 #9
0
        def __init__(self, mfd, gui, title='default'):
            Thread.__init__(self)
            self.gui = gui
            self.mfd = mfd
            # set up the localhost communications socket XXX: needs error checking
            proxy_server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            bound_proxy = False
            proxy_port = PTY_PROXY_PORT
            while bound_proxy == False:
                try:
                    proxy_server.bind(('127.0.0.1', proxy_port))
                    bound_proxy = True
                except:
                    proxy_port += 1
            print '*** localhost pty proxy port: %d ***' % proxy_port

            proxy_server.listen(1)
            self.client_fd = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            pty_proxy_client = RemotePtyProxy(self.client_fd, port=proxy_port)
            pty_proxy_client.start()
            self.remote_pty = proxy_server.accept()[0]
            fcntl.fcntl(self.remote_pty.fileno(), fcntl.F_SETFL, os.O_NONBLOCK)
            proxy_server.close()
            pty_proxy_client.join()

            self.term = vte.Terminal()
            self.win = gtk.Window()
            self.win.set_title(title)

            self.splice_loop = SpliceLoop(self.client_fd.fileno(), self.mfd.fileno(), self.win)
예제 #10
0
 def __init__(self):
     self.pathname = os.path.dirname(sys.argv[0])
     self.abspath = os.path.abspath(self.pathname)
     self.gladefile = self.abspath + "/basher-gtk.glade"
     self.window1 = gtk.glade.XML(self.gladefile,"window1",APP)
     self.working_dir = os.path.expanduser("~")
     self.callback_id = 0
     
     dic = {
         "on_button1_clicked" : self.on_button1_clicked,
         "on_button2_clicked" : self.on_button2_clicked,
         "on_button3_clicked" : self.on_button3_clicked,
         "on_button4_clicked" : self.on_button4_clicked,
         "on_button5_clicked" : self.on_button5_clicked,
         "on_button6_clicked" : self.on_button6_clicked,
         "on_button7_clicked" : self.quit,
         "on_button8_clicked" : self.on_button8_clicked,
         "on_button9_clicked" : self.on_button9_clicked,
         "on_button10_clicked" : self.on_button10_clicked,
         "on_button11_clicked" : self.on_button11_clicked,
         "on_button12_clicked" : self.on_button12_clicked,
         "on_button13_clicked" : self.on_button13_clicked,
         "on_window1_delete_event" : self.quit
     }
     
     self.window1.signal_autoconnect (dic)
     self.v = vte.Terminal ()
     self.window1.get_widget("vbox2").add(self.v)
     self.v.show()
     self.load_settings()
     msg_info(_("It is necessary to close all other windows and unmount any network shares while running Basher Backup. Please do so now and then click OK when you are ready to continue."), self.window1.get_widget("window1"))
예제 #11
0
    def run(self):
        """Configures and runs the download dialog"""
        self.wTree = gtk.glade.XML(self.gladefile, "DownloadDialog")
        events = {
            "on_expand_details": self.on_expand_details,
            "on_restart_process": self.on_restart_process
        }
        self.wTree.signal_autoconnect(events)

        self.dlg = self.wTree.get_widget("DownloadDialog")

        self.close_button = self.wTree.get_widget("btn_close")
        self.close_button.set_use_stock(True)

        self.details_section = self.wTree.get_widget("details_section")
        self.status_label = self.wTree.get_widget("lbl_status")

        self.progress_bar = self.wTree.get_widget("progressbar")
        self.progress_bar.pulse()
        self.timeout_handler_id = gobject.timeout_add(100,
                                                      self.update_progress_bar)
        self.start = time.time()

        terminal = vte.Terminal()
        terminal.connect("show", self.on_show_terminal)
        terminal.connect('child-exited', self.on_child_exited)
        self.details_section.add(terminal)

        self.dlg.show_all()
        self.result = self.dlg.run()
        self.dlg.destroy()
예제 #12
0
 def create_term_tab(self, connection, terminals):
     """
         A Terminal tab is composed of a tab page, a tab title, a scroll
         and the vte in the scroll.
     """
     scroll = gtk.ScrolledWindow()
     # By setting the POLICY_AUTOMATIC, the ScrollWindow resizes itself when hiding the TreeView
     scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_ALWAYS)
     v = vte.Terminal()
     # Send the scroll widget to the event so the notebook knows which child to close
     v.connect("child-exited",
               lambda term: self.event_die_term(scroll, terminals))
     v.connect("button-press-event", self.create_term_popup_menu)
     v.connect("key-press-event", self.event_terminal_key)
     #v.connect("contents-changed", self.event_terminal_changed)
     #v.connect("commit", self.event_terminal_changed)
     #v.connect("cursor-moved", self.event_terminal_changed)
     pid = None
     if connection != None:
         v.alias = connection.alias
         v.is_ssh = connection.get_type() == 'SSH'
         args = connection.get_fork_args()
         pid = v.fork_command(args[0], args, None, None, False, False,
                              False)
     else:
         v.alias = None
         v.is_ssh = False
         pid = v.fork_command()
     scroll.add(v)
     return scroll, pid
예제 #13
0
파일: terminals.py 프로젝트: PyCManager/a8
 def create_ui(self):
   self.widget.set_data('delegate', self)
   self.pid = None
   self.cwd = None
   self.box = gtk.HBox()
   self.box.set_spacing(3)
   self.widget.add(self.box)
   self.tools = gtk.VBox()
   self.tools2 = gtk.VBox()
   self.box.pack_start(self.tools, expand=False)
   self.stack = gtk.VBox()
   self.box.pack_start(self.stack)
   self.terminal = vte.Terminal()
   self.config = TerminalConfiguration()
   self.config.update(self.model.config.get('terminal', {}))
   self.config.configure(self.terminal)
   self.add_contexts()
   # Fix the size because by default it is huge.
   self.terminal.set_size_request(50, 50)
   self.stack.pack_start(self.terminal)
   self.scrollbar = gtk.VScrollbar()
   self.scrollbar.set_adjustment(self.terminal.get_adjustment())
   self.box.pack_start(self.scrollbar, expand=False)
   self.box.pack_start(self.tools2, expand=False)
   self.create_tools()
   self.create_finder()
예제 #14
0
    def button_clicked(self, widget, drive):
        term = vte.Terminal()
        term.set_encoding("UTF-8")
        term.set_font_from_string("monospace 10")
        term.set_color_background(gtk.gdk.color_parse('white'))
        term.set_color_foreground(gtk.gdk.color_parse('black'))
        term.connect("child_exited", self.child_died, widget)
        term.reset(gtk.TRUE, gtk.TRUE)

        self.drive = drive

        # free our fd's to the hard drive -- we have to
        # fstab.rescanDrives() after this or bad things happen!
        if os.access("/sbin/fdisk", os.X_OK):
            path = "/sbin/fdisk"
        else:
            path = "/usr/sbin/fdisk"

        isys.makeDevInode(drive, '/tmp/' + drive)

        term.fork_command(path, (path, '/tmp/' + drive))
        term.show()

        self.windowContainer.remove(self.buttonBox)
        self.windowContainer.pack_start(term)

        self.ics.readHTML("fdiskpart")
        cw = self.ics.getICW()
        if cw.displayHelp:
            cw.refreshHelp()

        self.ics.setPrevEnabled(0)
        self.ics.setNextEnabled(0)
예제 #15
0
    def __init__(self):
        gtk.HBox.__init__(self, False, 4)

        gconf_client.add_dir(self.GCONF_PROFILE_DIR,
                             gconf.CLIENT_PRELOAD_RECURSIVE)

        self._vte = vte.Terminal()
        self.reconfigure_vte()
        self._vte.set_size(self._vte.get_column_count(), 5)
        self._vte.set_size_request(200, 50)
        self._vte.show()
        self.pack_start(self._vte)

        self._scrollbar = gtk.VScrollbar(self._vte.get_adjustment())
        self._scrollbar.show()
        self.pack_start(self._scrollbar, False, False, 0)

        gconf_client.notify_add(self.GCONF_PROFILE_DIR,
                                self.on_gconf_notification)

        # we need to reconf colors if the style changes
        self._vte.connect("style-set",
                          lambda term, oldstyle: self.reconfigure_vte())
        self._vte.connect("key-press-event", self.on_vte_key_press)
        self._vte.connect("button-press-event", self.on_vte_button_press)
        self._vte.connect("popup-menu", self.on_vte_popup_menu)
        self._vte.connect("child-exited", lambda term: term.fork_command())

        self._vte.fork_command()
예제 #16
0
 def build(self, key):
     cmd = self.build_cmd(key)
     if cmd != None:
         background = None
         blink = 1
         font = "monospace 10"
         scrollback = 100
         terminal = vte.Terminal()
         terminal.get_pty()
         if (background):
             terminal.set_background_image(background)
         terminal.set_cursor_blinks(blink)
         terminal.set_font_from_string(font)
         terminal.set_scrollback_lines(scrollback)
         master, slave = os.openpty()
         self.terminals_prc[key] = Popen(["/bin/bash", "-c", cmd],
                                         stdin=slave,
                                         stdout=slave,
                                         stderr=slave)
         self.terminals_hope[key] = 5
         os.close(slave)
         terminal.set_pty(master)
         terminal.show()
         scrollbar = gtk.VScrollbar()
         scrollbar.set_adjustment(terminal.get_adjustment())
         box = gtk.HBox()
         box.pack_start(terminal)
         box.pack_start(scrollbar)
         return box
     else:
         return None
예제 #17
0
	def __init__(self):
		gladeUI = resin_config.gladeUI #get glade interface
		gladeUI.signal_autoconnect(self)
		self.window = gladeUI.get_widget("term_status")
		self.terminal = gladeUI.get_widget("ts_terminal")
		self.label = gladeUI.get_widget("ts_label")
		self.cancel = gladeUI.get_widget("term_cancel")
		self.vbox = gladeUI.get_widget("term_holder")
		self.prog_holder = gladeUI.get_widget("term_prog_holder")
		self.progress = gtk.ProgressBar()
		self.progress.set_size_request(-1,24)
		self.prog_holder.set_size_request(-1,24)
		self.prog_holder.pack_start(self.progress)
		self.progress.pulse()
		update_ui()
		self.progress.set_text("Initializing script")
		self.vte_terminal = vte.Terminal()
		self.vte_terminal.set_encoding("UTF-8")
		self.vte_terminal.set_font_from_string ('monospace')
		self.vte_terminal.set_color_dim(gtk.gdk.color_parse("white"))
		self.vte_terminal.set_color_foreground(gtk.gdk.color_parse("white"))
		self.vte_terminal.set_color_background(gtk.gdk.color_parse("black"))
		self.vte_terminal.set_cursor_blinks(True)
		self.vbox.pack_end(self.vte_terminal)
		self.vbox.show_all()
		update_ui()
		self.label.set_text("<span size='x-large'><b>Setting Up and Running Scripts</b></span>\n\nPlease Wait")
		self.label.set_use_markup(True)
		self.window.connect("delete-event",extra_functions.no_delete)
		self.window.set_icon_from_file(resin_config.images["windowIcon"])
		self.window.set_title(resin_config.version['name'])
		self.vte_terminal.grab_focus()
예제 #18
0
    def __init__(self, parent=None, title='Terminal'):
        gtk.Dialog.__init__(self,
                            parent=parent,
                            title=title,
                            buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))

        label = gtk.Label(title)
        label.set_alignment(xalign=0.0, yalign=0.5)
        self.vbox.pack_start(label)

        frame = gtk.Frame()
        frame.set_shadow_type(gtk.SHADOW_IN)
        self.vbox.pack_end(frame)

        hbox = gtk.HBox()
        frame.add(hbox)

        self.terminal = vte.Terminal()
        self.terminal.set_scrollback_lines(8192)
        #self.terminal.set_font_from_string('monospace 12')
        hbox.pack_start(self.terminal)

        scrollbar = gtk.VScrollbar()
        scrollbar.set_adjustment(self.terminal.get_adjustment())
        hbox.pack_end(scrollbar)

        self.show_all()
예제 #19
0
파일: console.py 프로젝트: COMU/cink
 def create_terminal(self):
     self.argv = ['bash']
     self.env = self.env_map_to_list(os.environ.copy())
     self.cwd = os.environ['HOME']
     self.is_fullscreen = False
     self.terminal = vte.Terminal()
     self.terminal.set_colors(gtk.gdk.color_parse('white'),
                              gtk.gdk.color_parse('pink'), [])
    def __init__(self):
        self.window = gtk.Window()
        self.window.set_position(gtk.WIN_POS_CENTER_ALWAYS)
        self.window.connect('delete_event', self.close_application)
        self.window.set_default_size(1350, 800)

        go_button = gtk.Button("go to...")
        go_button.connect("clicked", self._load_url)
        self.url_bar = gtk.Entry()
        self.url_bar.connect("activate", self._load_url)

        self.webview1 = webkit.WebView()

        self.go_back = gtk.Button("Back")
        self.go_back.connect("clicked", lambda x: self.webview.go_back())
        self.go_forward = gtk.Button("Forward")
        self.go_forward.connect("clicked", lambda x: self.webview.go_forward())

        url_box = gtk.HBox()
        url_box.pack_start(self.url_bar, True, True, 0)
        url_box.pack_start(go_button, True, True, 0)

        v = vte.Terminal()
        v.connect("child-exited", lambda term: gtk.main_quit())

        v.fork_command()

        vbox3 = gtk.VBox(spacing=0)
        vbox3.set_border_width(0)

        self.txt_url3 = gtk.Entry()
        self.txt_url3.connect('activate', self._txt_url_activate)

        vbox3.pack_start(url_box, fill=False, expand=False)

        vbox2 = gtk.VBox(spacing=1)
        vbox2.set_border_width(1)
        self.txt_url2 = gtk.Entry()
        self.txt_url2.connect('activate', self._txt_url_activate)
        self.scrolled_window2 = gtk.ScrolledWindow()
        self.scrolled_window2.add(self.webview1)
        vbox2.pack_start(self.scrolled_window2, fill=True, expand=True)

        vbox1 = gtk.VBox(spacing=1)
        vbox1.set_border_width(1)
        self.txt_url1 = gtk.Entry()
        self.txt_url1.connect('activate', self._txt_url_activate)
        self.scrolled_window1 = gtk.ScrolledWindow()
        self.scrolled_window1.add(v)
        vbox1.pack_start(self.scrolled_window1, fill=True, expand=True)

        vboxMain = gtk.VBox(False, 0)

        vboxMain.pack_start(vbox3, fill=False, expand=False)
        vboxMain.pack_start(vbox2, fill=True, expand=True)
        vboxMain.pack_start(vbox1, fill=True, expand=True)

        self.window.add(vboxMain)
예제 #21
0
파일: console.py 프로젝트: COMU/cink
 def __init__(self, *args, **kwds):
     terminal = vte.Terminal()
     terminal.fork_command('bash')
     win.set_resizable(False)
     win.connect('delete-event', gtk.main_quit)
     win.connect("key_press_event", self.key_pressed)
     win.move(300, 0)  #konsolun konumu
     win.add(terminal)
     win.show_all()
예제 #22
0
파일: notebook.py 프로젝트: COMU/cink
 def terminal_pane2(self,widget=None,data=None):
     self.terminal.append(vte.Terminal())
     self.term_indx += 1
     self.terminal_setting()
     self.term3 = self.terminal_action()
     self.hpane.append(gtk.HPaned())
     self.hpane[1].add1(self.term3)
     self.hbox_[self.index_].pack_end(self.hpane[1])
     self.hbox_[self.index_].show_all()
예제 #23
0
    def __init__(self, handle):
        import gtk, pango, platform, sys
        from ctypes import cdll

        if platform.machine().startswith('arm'):
            pass  # FIXME
        else:
            if platform.architecture()[0] == '64bit':
                vte_path = "x86-64"
            else:
                vte_path = "x86"
            vte = cdll.LoadLibrary("lib/%s/libvte.so.9" % vte_path)
        sys.path.append("lib/%s" % vte_path)

        import vte

        super(VteActivity, self).__init__(handle, create_jobject=False)
        self.__source_object_id = None

        # creates vte widget
        self._vte = vte.Terminal()

        if DEBUG_TERMINAL:
            toolbox = activity.ActivityToolbox(self)
            toolbar = toolbox.get_activity_toolbar()
            self.set_toolbox(toolbox)

            self._vte.set_size(30, 5)
            self._vte.set_size_request(200, 300)
            font = 'Monospace 10'
            self._vte.set_font(pango.FontDescription(font))
            self._vte.set_colors(gtk.gdk.color_parse('#E7E7E7'),
                                 gtk.gdk.color_parse('#000000'), [])

            vtebox = gtk.HBox()
            vtebox.pack_start(self._vte)
            vtesb = gtk.VScrollbar(self._vte.get_adjustment())
            vtesb.show()
            vtebox.pack_start(vtesb, False, False, 0)
            self.set_canvas(vtebox)

            toolbox.show()
            self.show_all()
            toolbar.share.hide()
            toolbar.keep.hide()

        # now start subprocess.
        self._vte.connect('child-exited', self.on_child_exit)
        self._vte.grab_focus()
        bundle_path = activity.get_bundle_path()
        self._pid = self._vte.fork_command \
            (command='/bin/sh',
             argv=['/bin/sh','-c',
             'python %s/blocku.py' % bundle_path],
             envv=["PYTHONPATH=%s/library" % bundle_path],
             directory=bundle_path)
예제 #24
0
파일: term.py 프로젝트: appotry/Ailurus
    def __init__(self):
        terminal = vte.Terminal()
        terminal.connect('child-exited', self.exit) 
        self.terminal = terminal

        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        window.set_position(gtk.WIN_POS_CENTER)
        window.connect('delete-event', self.exit)
        window.add(terminal)
        window.show_all()
예제 #25
0
 def __init__(self):
     self.can_exit = self.flag = False
     self.terminal = vte.Terminal()
     self.terminal.connect('child-exited', lambda *w: self.child_exited())
     self.terminal.set_size_request(650, 420)
     self.window = window = gtk.Window(gtk.WINDOW_TOPLEVEL)
     window.set_position(gtk.WIN_POS_CENTER)
     window.set_keep_above(True)
     window.add(self.terminal)
     window.connect('delete-event', self.delete_event)
     window.show_all()
예제 #26
0
 def __init__(self):
     super(VteTerminalScreen, self).__init__()
     self.term = vte.Terminal()
     self.__termbox = gtk.HBox()
     self.__scroll = gtk.VScrollbar(self.term.get_adjustment())
     border = gtk.Frame()
     border.set_shadow_type(gtk.SHADOW_ETCHED_IN)
     border.add(self.term)
     self.__termbox.pack_start(border)
     self.__termbox.pack_start(self.__scroll, False)
     self.add(self.__termbox)
예제 #27
0
파일: notebook.py 프로젝트: COMU/cink
    def terminal_hpane(self):

        self.terminal.append(vte.Terminal())
        self.term_indx +=1
        self.terminal_setting()
        self.term1 = self.terminal_action()
        self.hpane.append(gtk.HPaned())    
        
        self.hpane[0].add1(self.term1)
        self.hpane[0].pack1(self.term1,True,True)

        self.terminal.append(vte.Terminal())
        self.term_indx +=1
        self.terminal_setting()
        self.term2 = self.terminal_action()
#        self.hpane[0].set_position(150)
        self.hpane[0].add2(self.term2) 
        self.hpane[0].pack2(self.term2,True,True)
        self.hpane[0].set_usize(350,350)
        self.hbox_[self.index_].pack_start(self.hpane[0])
예제 #28
0
 def __init__(self):
   gtk.Window.__init__(self)
   self.set_title("GDB Innards")
   self.term = vte.Terminal()
   self.term.set_pty(master)
   sw = gtk.ScrolledWindow()
   sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
   sw.add(self.term)
   self.add(sw)
   self.set_size_request(800,500)
   self.show_all()
예제 #29
0
 def install (self, button):
     self.builder.get_object("notebook1").set_current_page(1)
     term = vte.Terminal()
     pid = term.fork_command('dash')
     term.set_emulation('xterm')
     if self.downgrade_mode:
         term.feed_child("apt-get install %s\n" % " ".join(self.foreign_packages))
     else:
         term.feed_child("apt-get remove --purge %s\n" % " ".join(self.foreign_packages))
     term.show()
     self.builder.get_object("vbox_vte").add(term)
     self.builder.get_object("vbox_vte").show_all()
예제 #30
0
파일: promgui.py 프로젝트: wpyok500/prom
def main():
    global __file__
    __file__ = os.path.abspath(__file__)
    if os.path.islink(__file__):
        __file__ = getattr(os, 'readlink', lambda x: x)(__file__)
    os.chdir(os.path.dirname(os.path.abspath(__file__)))

    if os.path.isfile('promgui.desktop'):
        rewrite_desktop('promgui.desktop')

    PromGTK(gtk.Window(), vte.Terminal())
    gtk.main()