Beispiel #1
0
    def create_ui(self):
        self.webview = webkit.WebView()

        self.ready = True
        self.html_map = ""

        sw = gtk.ScrolledWindow()
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
        sw.add(self.webview)

        self.pack_start(sw)

        self.show_all()
Beispiel #2
0
 def __init__(self):
     self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
     self.window.set_position(gtk.WIN_POS_CENTER_ALWAYS)
     self.window.connect('delete_event', self.close_application)
     self.window.set_default_size(350, 20)
     vbox = gtk.VBox(spacing=5)
     vbox.set_border_width(5)
     self.txt_url = gtk.Entry()
     self.txt_url.connect('activate', self._txt_url_activate)
     self.scrolled_window = gtk.ScrolledWindow()
     self.webview = webkit.WebView()
     self.scrolled_window.add(self.webview)
     vbox.pack_start(self.scrolled_window, fill=True, expand=True)
     self.window.add(vbox)
Beispiel #3
0
    def __init__(self, *args, **kargs):
        gtk.ScrolledWindow.__init__(self, *args, **kargs)
        self.webview = webkit.WebView()
        self.add(self.webview)

        #self.webview.connect('populate-popup', self.on_populate_popup)
        self.webview.connect('button-press-event', self.on_button_press)
        self.nav_signal = self.webview.connect('navigation-requested',
                                               self.on_navigate)

        self.search_text = ''
        self.webview.connect('load-finished', self.on_load_finished)

        self.show_all()
Beispiel #4
0
 def __init__(self, data_path=None, vbox=None, waypoint=None, parent=None):
     logging.debug(">>")
     self.data_path = data_path
     self.extension = Extension()
     self.wkview = webkit.WebView()
     self.wkview.connect('notify::title', self.handle_title_changed)
     scrolled_window = gtk.ScrolledWindow()
     scrolled_window.add(self.wkview)
     vbox.pack_start(scrolled_window, True, True)
     vbox.show_all()
     self.htmlfile = ""
     self.waypoint = waypoint
     self.pytrainer_main = parent
     logging.debug("<<")
Beispiel #5
0
    def __init__(self, token, uuid, **args):
        gtk.Window.__init__(self, **args)

        self.token = token
        self.uuid = uuid
        self.timer = -1

        self.set_title('Kobita')
        self.connect('show', self.on_show)
        self.set_default_size(800, 600)
        self.set_border_width(5)

        hbox = gtk.HBox(True, 5)

        vbox = gtk.VBox(False, 5)
        sw = gtk.ScrolledWindow()
        sw.set_shadow_type(gtk.SHADOW_ETCHED_OUT)
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        self.buffer = gtksourceview2.Buffer()
        self.buffer.set_max_undo_levels(1000)
        self.buffer.connect('changed', self.on_changed)
        self.edit = gtksourceview2.View(self.buffer)
        sw.add(self.edit)
        vbox.pack_start(sw, True, True, 0)
        hhbox = gtk.HBox(False, 5)
        self.tags = []
        for n in range(5):
            tag = gtk.Entry()
            tag.set_usize(20, -1)
            hhbox.add(tag)
            self.tags.append(tag)
        vbox.pack_start(hhbox, False, False, 0)
        hhbox = gtk.HBox(True, 5)
        self.check = gtk.CheckButton('Private')
        hhbox.add(self.check)
        button = gtk.Button("Publish")
        button.connect('clicked', self.on_publish)
        hhbox.add(button)
        vbox.pack_end(hhbox, False, False, 0)
        hbox.pack_start(vbox, False, True, 0)

        sw = gtk.ScrolledWindow()
        sw.set_shadow_type(gtk.SHADOW_ETCHED_OUT)
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        self.view = webkit.WebView()
        self.view.set_settings(settings)
        sw.add(self.view)
        hbox.pack_start(sw, False, True, 0)

        self.add(hbox)
Beispiel #6
0
    def __init__(self):
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.set_resizable(True)
        self.window.connect("delete_event", self.delete_event)
        self.window.connect("destroy", self.destroy)
        self.window.set_default_size(460, 670)
        self.web_view = webkit.WebView()
        self.web_view.open(self.default_site)

        scroll_window = gtk.ScrolledWindow(None, None)
        scroll_window.add(self.web_view)

        self.window.add(scroll_window)
        self.window.show_all()
Beispiel #7
0
    def _create_browser(self, url):

        gobject.threads_init()
        self.window = gtk.Window()
        self.window.set_default_size(800, 600)
        self.window.connect("destroy", lambda a: gtk.main_quit())

        browser = webkit.WebView()
        browser.connect("navigation-requested", self._navigation_requested)
        browser.open(url)

        self.window.add(browser)
        self.window.show_all()
        gtk.main()
Beispiel #8
0
 def __init__(self, *args, **kwargs):
     wx.Panel.__init__(self, *args, **kwargs)
     # Aquí es donde se hace la "magia" de embeber webkit en wxGTK.
     whdl = self.GetHandle()
     window = gtk.gdk.window_lookup(whdl)
     # Debemos mantener la referencia a "pizza", sino obtenemos un segfault.
     self.pizza = window.get_user_data()
     # Obtengo el padre de la clase GtkPizza, un gtk.ScrolledWindow
     self.scrolled_window = self.pizza.parent
     # Saco el objeto GtkPizza para poner un WebView en su lugar
     self.scrolled_window.remove(self.pizza)
     self.webview = webkit.WebView()
     self.scrolled_window.add(self.webview)
     self.scrolled_window.show_all()
Beispiel #9
0
    def __init__(self, parent):
        gtk.Window.__init__(self)

        self.mainwin = parent
        self.set_title(_('Secure Authentication'))
        self.set_default_size(800, 450)
        self.set_transient_for(parent)
        self.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
        self.connect('delete-event', self.quit)

        self.settings = webkit.WebSettings()
        self.view = webkit.WebView()
        self.view.set_settings(self.settings)

        scroll = gtk.ScrolledWindow()
        scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        scroll.set_shadow_type(gtk.SHADOW_IN)
        scroll.add(self.view)

        self.label = gtk.Label()
        self.label.set_use_markup(True)
        self.label.set_alignment(0, 0)
        #self.label.set_line_wrap(True)
        self.label.set_markup(
            _('Autorize Turpial and copy the given number \
(<b>PIN</b>) in the text box below:'))
        #self.label.set_justify(gtk.JUSTIFY_FILL)

        lblbox = gtk.HBox(False, 2)
        lblbox.pack_start(self.label, True, True, 2)

        self.pin = gtk.Entry()
        cancel = gtk.Button(stock=gtk.STOCK_CANCEL)
        accept = gtk.Button(stock=gtk.STOCK_OK)

        hbox = gtk.HBox(False, 0)
        hbox.pack_start(self.pin, True, True, 2)
        hbox.pack_start(cancel, False, False, 2)
        hbox.pack_start(accept, False, False, 2)

        vbox = gtk.VBox(False, 5)
        vbox.pack_start(scroll, True, True, 0)
        vbox.pack_start(lblbox, False, False, 2)
        vbox.pack_start(hbox, False, False, 2)

        cancel.connect('clicked', self.quit)
        accept.connect('clicked', self.__accept)

        self.add(vbox)
Beispiel #10
0
    def __init__(self):
        gtk.Window.__init__(self)

        self.set_size_request(800, 600)
        self.connect('destroy', gtk.main_quit)

        self.webview = webkit.WebView()
        self.webview.drag_dest_set(
            gtk.DEST_DEFAULT_ALL, self.TARGET[:-1],
            gtk.gdk.ACTION_COPY | gtk.gdk.ACTION_MOVE | gtk.gdk.ACTION_LINK)
        self.webview.connect('drag-data-received', self.on_drag_data_received)

        self.add(self.webview)

        self.webview.load_uri('http://www.baidu.com')
Beispiel #11
0
 def __init__(self):
     self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
     self.window.fullscreen()
     #self.window.set_default_size(600,400)
     #self.window.set_resizable(True)
     self.web_view = webkit.WebView()
     self.web_view.open(str(sys.argv[1]))
     scroll_window = gtk.ScrolledWindow(None, None)
     scroll_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_NEVER)
     scroll_window.set_placement(gtk.CORNER_TOP_LEFT)
     scroll_window.add(self.web_view)
     box = gtk.VBox(False, 0)
     box.add(scroll_window)
     self.window.add(box)
     self.window.show_all()
Beispiel #12
0
    def __init__(self):
        self.mainWindow = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.mainWindow.connect("delete_event", lambda *x: gtk.main_quit ())
        self.mainWindow.set_size_request(800, 600)

        self.scrolledWindow = gtk.ScrolledWindow()
        self.mainWindow.add(self.scrolledWindow)

        self.webView = webkit.WebView()
        self.webView.connect("load-finished", self.load_finished_cb)
        self.scrolledWindow.add(self.webView)

        settings = self.webView.get_settings()
        settings.set_property("auto-load-images", False)
        settings.set_property("enable-plugins", False)
Beispiel #13
0
def lienInAmelia():

    import gtk
    import webkit
    import gobject

    gobject.threads_init()
    window = gtk.Window()
    window.set_default_size(1100, 680)
    window.connect("destroy", lambda a: gtk.main_quit())
    browser = webkit.WebView()
    browser.open("http://alfred-ia.org/essaye-moi/")
    window.add(browser)
    window.show_all()
    gtk.main()
Beispiel #14
0
    def createWidgets(self):
        #Set the Glade file
        filename = "./gui/gui.glade"
        builder = gtk.Builder()
        builder.add_from_file(filename)

        self.statusbar = builder.get_object("statusbar")
        window = builder.get_object("mainWindow")
        builder.connect_signals(self)

        box = builder.get_object("topologyBox")
        self.browser = webkit.WebView()
        canvas = gtk.ScrolledWindow()
        canvas.add(self.browser)
        # Pack topology into the box
        box.pack_start(canvas, True, True, 0)

        box = builder.get_object("topologyBoxDiscovered")
        builder.connect_signals(self)
        self.browserDiscovered = webkit.WebView()
        canvas = gtk.ScrolledWindow()
        canvas.add(self.browserDiscovered)
        # Pack topology into the box
        box.pack_start(canvas, True, True, 0)

        self.draw_callback(None)

        button = builder.get_object("submit")
        button.connect("clicked", self.submit_callback,
                       builder.get_object("entry_input"))
        button = builder.get_object("refresh")
        button.connect("clicked", self.draw_callback)
        button = builder.get_object("inject")
        button.connect("clicked", self.inject_callback)

        window.show_all()
    def __init__(self, browser, url):
        self.webview = webkit.WebView()
        self.webview.connect("title-changed", self.changetitle)
        self.webview.connect("load-progress-changed", self.changeprogress)
        self.webview.connect("load-started", self.loadstarted)
        self.webview.connect("load-finished", self.loadfinished)

        self.webview.open(url)

        self.scroller = gtk.ScrolledWindow()
        self.scroller.add(self.webview)

        if not browser:
            raise RuntimeError()
        self.browser = browser
Beispiel #16
0
	def init_gtk(self, _):
		self.window = gtk.Window()
		self.window.set_title("Autonose")
		
		scrollView = gtk.ScrolledWindow()
		self.browser = webkit.WebView()
		self.browser.connect('navigation_requested', self._navigation_requested_cb)
		scrollView.add(self.browser)

		self.window.set_default_size(800, 600)
		self.window.connect('destroy', self.quit)

		self.window.add(scrollView)
		self.update("<h1>loading...</h1>")
		self.window.show_all()
Beispiel #17
0
    def __init__(self):
        gtk.ScrolledWindow.__init__(self)
        self.set_shadow_type(gtk.SHADOW_ETCHED_IN)

        self._view = webkit.WebView()
        settings = self._view.props.settings
        settings.props.enable_developer_extras = True
        settings.props.user_agent = USER_AGENT
        settings.props.enable_default_context_menu = False

        self._view.get_web_inspector().connect(
            'inspect-web-view', self._on_inspector__inspect_web_view)
        self._view.connect('navigation-policy-decision-requested',
                           self._on_view__navigation_policy_decision_requested)
        self.add(self._view)
        self._view.show()
Beispiel #18
0
    def get_notebook_description(self):
        # Make the HTML viewable area
        self.description = webkit.WebView()

        # Disable the plugins for the webview
        ws = self.description.get_settings()
        ws.set_property('enable-plugins', False)
        self.description.set_settings(ws)
        self.description.show()

        desc_scroll = gtk.ScrolledWindow()
        desc_scroll.add(self.description)
        desc_scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        desc_scroll.show()

        return desc_scroll
Beispiel #19
0
    def __init__(self):
        w = gtk.Window(gtk.WINDOW_TOPLEVEL)
        w.resize(800, 600)

        view = webkit.WebView()
        sw = gtk.ScrolledWindow()
        sw.add(view)
        w.add(sw)
        w.show_all()

        w.connect("delete-event", gtk.main_quit)

        fs_toggler = FullscreenToggler(w)
        controls = Controls(w, view, fs_toggler)
        reactor.listenTCP(9001, TcpControlFactory(controls))
        reactor.run()
Beispiel #20
0
    def __init__(self, **args):
        gtk.Window.__init__(self, **args)

        self.set_title('Kobita')
        self.set_default_size(800, 600)
        self.set_border_width(5)
        self.connect('delete-event', gtk.main_quit)
        self.connect('show', self.on_show)

        hbox = gtk.HBox(True, 5)

        vbox = gtk.VBox(False, 5)
        sw = gtk.ScrolledWindow()
        sw.set_shadow_type(gtk.SHADOW_ETCHED_OUT)
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        self.tv = gtk.TreeView(model=gtk.ListStore(str, str))
        fontdesc = pango.FontDescription("%s %d" % (font_default, font_size))
        self.tv.modify_font(fontdesc)
        self.tv.set_grid_lines(gtk.TREE_VIEW_GRID_LINES_BOTH)
        self.tv.get_selection().connect('changed', self.on_selection_changed)
        self.tv.set_headers_visible(False)
        self.tv.connect('row-activated', self.on_row_activated)
        renderer = gtk.CellRendererText()
        tvc = gtk.TreeViewColumn('uuid', renderer, text=0)
        tvc.set_visible(False)
        self.tv.append_column(tvc)
        tvc = gtk.TreeViewColumn('title', renderer, text=1)
        self.tv.append_column(tvc)
        sw.add(self.tv)
        vbox.pack_start(sw, True, True, 0)
        button = gtk.Button("New Entry")
        button.connect('clicked', self.on_new_entry)
        vbox.pack_end(button, False, False, 0)
        button = gtk.Button("Delete Entry")
        button.connect('clicked', self.on_delete)
        vbox.pack_end(button, False, False, 0)
        hbox.pack_start(vbox, False, True, 0)

        sw = gtk.ScrolledWindow()
        sw.set_shadow_type(gtk.SHADOW_ETCHED_OUT)
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        self.view = webkit.WebView()
        self.view.set_settings(settings)
        sw.add(self.view)
        hbox.pack_start(sw, False, True, 0)

        self.add(hbox)
Beispiel #21
0
    def initialize_components(self):
        # The big box to hold them all:
        box = gtk.VBox(False, 2)
        self.add(box)

        # The browser engine container:
        webview = webkit.WebView()

        # Scrollable box for the WebView:
        scroller = gtk.ScrolledWindow()
        scroller.add(webview)

        # A toolbar with all the necessary controls:
        toolbar = gtk.Toolbar()
        toolbar.set_style(gtk.TOOLBAR_ICONS)

        # Buttons and stuff:
        # newTb = gtk.ToolButton(gtk.STOCK_NEW)
        clear_button = gtk.ToolButton(gtk.STOCK_CLEAR)
        refresh_button = gtk.ToolButton(gtk.STOCK_REFRESH)
        go_button = gtk.ToolButton(gtk.STOCK_GO_FORWARD)
        back_button = gtk.ToolButton(gtk.STOCK_GO_BACK)

        # The address bar needs to be split because Toolbar only accepts ToolItems.
        addressbar_item = gtk.ToolItem()
        addressbar = gtk.Entry()
        addressbar.connect('key_press_event', self.on_key_press, webview)
        addressbar.set_width_chars(100)
        addressbar_item.add(addressbar)

        # Let's give the buttons a purpose:
        go_button.connect('clicked', self.go, webview, addressbar)
        clear_button.connect('clicked', Toolbox.clear_text, addressbar)
        back_button.connect('clicked', Toolbox.go_back, webview)
        refresh_button.connect('clicked', Toolbox.refresh, webview)

        # Assemble the toolbar:
        # toolbar.insert(newTb, 0)
        toolbar.insert(back_button, 0)
        toolbar.insert(refresh_button, 1)
        toolbar.insert(addressbar_item, 2)
        toolbar.insert(clear_button, 3)
        toolbar.insert(go_button, 4)

        # Put it all in a box:
        box.pack_start(toolbar, False, False, 0)
        box.pack_start(scroller)
Beispiel #22
0
    def __init__(self, mainwin, label='', menu='normal'):
        gtk.VBox.__init__(self, False)

        self.last = None  # Last tweets updated
        self.mainwin = mainwin
        style_path = os.path.join(os.path.dirname(__file__), '..', '..',
                                  'data', 'themes', 'default', 'style.css')
        template_path = os.path.join(os.path.dirname(__file__), '..', '..',
                                     'data', 'themes', 'default',
                                     'tweet_template.html')

        #self.header = '<link href="%s" rel="stylesheet" type="text/css">' % style_path
        #self.header = ''
        f = open(style_path, 'r')
        self.css_template = f.read()
        f.close()
        self.header = '<style type="text/css"> %s </style>' % self.css_template
        self.page = self.header
        f = open(template_path, 'r')
        self.tweet_template = f.read()
        f.close()

        self.list = webkit.WebView()
        self.settings = webkit.WebSettings()
        self.list.set_settings(self.settings)

        self.label = gtk.Label(label)
        self.caption = label

        self.lblerror = gtk.Label()
        self.lblerror.set_use_markup(True)
        self.waiting = CairoWaiting(self.mainwin)
        align = gtk.Alignment(xalign=1, yalign=0.5)
        align.add(self.waiting)

        bottombox = gtk.HBox(False)
        bottombox.pack_start(self.lblerror, False, False, 2)
        bottombox.pack_start(align, True, True, 2)

        scroll = gtk.ScrolledWindow()
        scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        scroll.set_shadow_type(gtk.SHADOW_IN)
        scroll.add(self.list)

        self.pack_start(scroll, True, True)
        self.pack_start(bottombox, False, False)
    def ventana_con_webview(self, web_view, web_frame):
        self.dir_ventana_emergente = None
        scroll = gtk.ScrolledWindow()
        navegador = webkit.WebView()
        scroll.add(navegador)

        ventana = gtk.Window()
        ventana.set_title("AguBrowser 2.0")
        ventana.add(scroll)

        ventana.show_all()
        ventana.resize(640, 400)

        navegador.connect("title-changed", self.webview_titulo, ventana)
        web_view.connect("download-requested", self.descargar_archivo, ventana)

        return navegador
 def _grab_fb_app_token(self):
     url = self._get_auth_url()
     w = gtk.Window()
     sw = gtk.ScrolledWindow()
     sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
     sw.show()
     w.move(200, 200)
     w.set_size_request(800, 400)
     wkv = webkit.WebView()
     wkv.load_uri(url)
     wkv.grab_focus()
     wkv.connect('navigation-policy-decision-requested',
                 self._nav_policy_cb)
     sw.add_with_viewport(wkv)
     w.add(sw)
     w.show_all()
     self._auth_win = w
Beispiel #25
0
    def _build_ui(self):
        sw = gtk.ScrolledWindow()
        sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
        self.vbox.remove(self.main)
        self.vbox.add(sw)
        sw.show()

        if platform.system() != 'Windows':
            import webkit
            self._view = webkit.WebView()
            self._view.connect(
                'navigation-policy-decision-requested',
                self._on_view__navigation_policy_decision_requested)
            sw.add(self._view)
            self._view.show()
        else:
            self._view = None
Beispiel #26
0
	def __init__(self):
		self.about = AX_About()
		gladeUI = resin_config.gladeUI
		gladeUI.signal_autoconnect(self)
		self.window = gladeUI.get_widget("main_interface")
		self.catalog_tree = gladeUI.get_widget("catalog_tree")
		self.menu_tree = gladeUI.get_widget("menu_tree")
		self.catalog_tree_page2 = gladeUI.get_widget("catalog_tree_page2")
		self.menu_tree_page2 = gladeUI.get_widget("menu_tree_page2")
		self.status_bar = gladeUI.get_widget("statusbar1")
		self.menu_quit = gladeUI.get_widget("quit1")
		self.menu_about = gladeUI.get_widget("about_automatix2")
		self.menu_licence = gladeUI.get_widget("licence_info")
		self.menu_credits = gladeUI.get_widget("menu_credits")
		self.menu_restore = gladeUI.get_widget("restore_sources")
		self.menu_keep_debs = gladeUI.get_widget("keep_debs")
		self.menu_view_help = gladeUI.get_widget("view_help")
		self.menu_view_activity_log1 = gladeUI.get_widget("view_activity_log1")
		self.menu_view_sources = gladeUI.get_widget("sources")
		self.menu_view_changelog = gladeUI.get_widget("change_log")
		self.menu_errors_and_information = gladeUI.get_widget("errors_and_information1")
		self.start_button = gladeUI.get_widget("start_scripts")
		self.notebook = gladeUI.get_widget("notebook1")
		self.page2_label = gladeUI.get_widget("page2_label")
		self.toolbar = gladeUI.get_widget("toolbar1")
		self.toggle_apps =  gladeUI.get_widget("toggle-apps")
		self.toggle_icon = gtk.Image()
		self.toggle_icon.set_from_file(conf.toggle_icons[0])
		self.toggle_apps.set_icon_widget(self.toggle_icon);
		self.toggle_apps.set_label("Deselect all")
		self.show_apps =  gladeUI.get_widget("showButton")
		self.view_menu =  gladeUI.get_widget("view1_menu")
		self.show_apps.connect("clicked",lambda signal:self.show_apps.get_menu().popup());
		self.showIcon = gtk.Image()
		self.showIcon.set_from_file(resin_config.images["viewIcon"])
		self.show_apps.set_icon_widget(self.showIcon)
		#self.show_apps.set_menu(self.view_menu)
		self.info_holder =  gladeUI.get_widget("infoholder")
		self.info_html = webkit.WebView()
		self.info_html.get_settings().set_property("enable-default-context-menu", False)
		self.info_html.load_html_string("<html><head></head><body></body></html>", "about:blank")
		self.info_holder.add(self.info_html)
		conf.trayIcon = self.makeTrayIcon(self.window)
		extra_functions.update_ui()
		self.window.set_role("MAIN_WINDOW")
		self.window.show_all()
Beispiel #27
0
    def post_show_init(self, widget):
        if utils.RUNNING_HILDON:
            logging.debug("Hildon: Not using ajax view")
            self._USING_AJAX = False
        else:
            self._USING_AJAX = True

        if utils.HAS_GCONF:
            try:
                import gconf
            except:
                from gnome import gconf
            self._conf = gconf.client_get_default()
            self._conf.notify_add('/desktop/gnome/interface/font_name',
                                  self._gconf_reset_webview_font)
        self._reset_webview_font()

        logging.info("Loading Webkit renderer")
        self._webview = webkit.WebView()
        #self._webview.connect("new-window", self._new_window)
        self._webview.connect("hovering-over-link", self._link_message)
        self._webview.connect("navigation-policy-decision-requested",
                              self._nav_policy)
        self._webview.connect("new-window-policy-decision-requested",
                              self._nav_policy)
        self._webview.connect("realize", self._realize, True)
        self._webview.connect("unrealize", self._realize, False)
        self._webview.connect("status-bar-text-changed", self._console_message)
        #self._webview.connect("script-alert", lambda a,b,c: logging.debug("script-alert"))
        #self._webview.connect("script-confirm", lambda a,b,c: logging.debug("script-confirm"))

        # This is a disgusting hack because I haven't made PenguinTV work with gio
        try:
            scaling_factor = os.popen(
                "gsettings get org.gnome.desktop.interface text-scaling-factor"
            )
            scaling_factor = float(scaling_factor.readline().strip())
            if scaling_factor != 1.0:
                self._webview.set_full_content_zoom(True)
                self._webview.set_zoom_level(scaling_factor)
        except:
            logging.warning("Couldn't get text scaling factor from gsettings")

        widget.add(self._webview)
        self._webview.show()
    def activate(self, window):
        self.window = window
        self.gconf_root_dir = "/apps/gedit-2/plugins/markdownpreview"
        self.load_config()

        action = ("Markdown Preview", None, "Markdown Preview",
                  "<Control><Shift>M", "Update the HTML preview",
                  lambda x, y: self.update_preview(y))

        # Store data in the window object
        windowdata = dict()
        window.set_data("MarkdownPreviewData", windowdata)

        self.scrolled_window = gtk.ScrolledWindow()
        self.scrolled_window.set_property("hscrollbar-policy",
                                          gtk.POLICY_AUTOMATIC)
        self.scrolled_window.set_property("vscrollbar-policy",
                                          gtk.POLICY_AUTOMATIC)
        self.scrolled_window.set_property("shadow-type", gtk.SHADOW_IN)

        html_doc = webkit.WebView()

        home = os.path.expanduser("~")
        html_doc.load_string(DEFAULT_HTML_TEMPLATE % (home, home, home, ""),
                             "text/html", "utf-8", "file:///")

        self.scrolled_window.add(html_doc)
        self.scrolled_window.show_all()

        self.generate_preview_panel()

        windowdata["preview_panel"] = self.scrolled_window
        windowdata["html_doc"] = html_doc

        windowdata["action_group"] = gtk.ActionGroup("MarkdownPreviewActions")
        windowdata["action_group"].add_actions([action], window)

        manager = window.get_ui_manager()
        manager.insert_action_group(windowdata["action_group"], -1)

        windowdata["ui_id"] = manager.new_merge_id()

        manager.add_ui(windowdata["ui_id"], "/MenuBar/ToolsMenu/ToolsOps_5",
                       "Markdown Preview", "Markdown Preview",
                       gtk.UI_MANAGER_MENUITEM, True)
Beispiel #29
0
    def _inspect_web_view_cb(self, inspector, web_view):
        """
        Called when the 'inspect' menu item is activated.
        """
        scrolled_window = gtk.ScrolledWindow()
        scrolled_window.props.hscrollbar_policy = gtk.POLICY_AUTOMATIC
        scrolled_window.props.vscrollbar_policy = gtk.POLICY_AUTOMATIC
        webview = webkit.WebView()
        scrolled_window.add(webview)
        scrolled_window.show_all()

        self.add(scrolled_window)

        ##  Modified to make window bigger, and add title  ##
        self.set_default_size(650, 400)
        self.set_title("Webkit Inspector")

        return webview
Beispiel #30
0
    def create_window(self):
        self.window = gtk.Window()
        self.window.set_title(self.title)

        self.window.connect("destroy", lambda w: gtk.main_quit())
        self.window.connect("realize", self.on_realize)
        self.window.connect("key_press_event", self.on_key_press_event)

        self.vbox = gtk.VBox()
        self.window.add(self.vbox)

        self.scrolled_window = gtk.ScrolledWindow()
        self.vbox.pack_start(self.scrolled_window)

        self.webview = webkit.WebView()
        self.scrolled_window.add(self.webview)

        self.webview.open(self.app_url)