当前位置: 首页>>代码示例>>Python>>正文


Python Gtk.TextView方法代码示例

本文整理汇总了Python中gi.repository.Gtk.TextView方法的典型用法代码示例。如果您正苦于以下问题:Python Gtk.TextView方法的具体用法?Python Gtk.TextView怎么用?Python Gtk.TextView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gi.repository.Gtk的用法示例。


在下文中一共展示了Gtk.TextView方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import TextView [as 别名]
def __init__(self, *args, **kwargs):
		self.label = Gtk.Label(label='Send')
		"""The :py:class:`Gtk.Label` representing this tabs name."""
		super(MailSenderSendTab, self).__init__(*args, **kwargs)
		self.textview = self.gobjects['textview_mail_sender_progress']
		"""The :py:class:`Gtk.TextView` object that renders text status messages."""
		self.textview.modify_font(Pango.FontDescription(self.config['text_font']))
		self.textbuffer = self.textview.get_buffer()
		"""The :py:class:`Gtk.TextBuffer` instance associated with :py:attr:`~.MailSenderSendTab.textview`."""
		self.textbuffer_iter = self.textbuffer.get_start_iter()
		self.progressbar = self.gobjects['progressbar_mail_sender']
		"""The :py:class:`Gtk.ProgressBar` instance which is used to display progress of sending messages."""
		self.pause_button = self.gobjects['togglebutton_mail_sender_pause']
		self.sender_thread = None
		"""The :py:class:`.MailSenderThread` instance that is being used to send messages."""
		self.application.connect('exit', self.signal_kpc_exit)
		self.application.connect('exit-confirm', self.signal_kpc_exit_confirm)
		self.textview.connect('populate-popup', self.signal_textview_populate_popup) 
开发者ID:rsmusllp,项目名称:king-phisher,代码行数:20,代码来源:mail.py

示例2: on_menuitem_custom_activate

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import TextView [as 别名]
def on_menuitem_custom_activate(self, widget):
        self.custom_window = Gtk.Window()
        self.custom_window.set_default_size(640, 480)
        self.custom_window.set_position(Gtk.WindowPosition.CENTER)
        self.custom_window.set_title("Custom CSS")

        self.custom_vbox = Gtk.VBox()
        self.custom_scroller = Gtk.ScrolledWindow()
        self.custom_button = Gtk.Button("Apply")
        self.custom_vbox.pack_end(self.custom_button, False, False, 0)
        self.custom_text_view = Gtk.TextView()
        self.custom_text_buffer = Gtk.TextBuffer()
        self.custom_text_buffer.set_text(self.custom_css)
        self.custom_text_view.set_buffer(self.custom_text_buffer)
        self.custom_scroller.add(self.custom_text_view)
        self.custom_vbox.pack_start(self.custom_scroller, True, True, 0)
        self.custom_window.add(self.custom_vbox)
        self.custom_window.show_all()
        self.custom_button.connect("clicked", self.apply_custom_css, self.custom_window, self.custom_text_buffer) 
开发者ID:jamiemcg,项目名称:Remarkable,代码行数:21,代码来源:RemarkableWindow.py

示例3: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import TextView [as 别名]
def __init__(self):
        # Gtk.ScrolledWindow.__init__(self)
        # FlatCAMApp.App.log.debug('Gtk.ScrolledWindow.__init__(self)')
        super(FCTextArea, self).__init__()
        FlatCAMApp.App.log.debug('super(FCTextArea, self).__init__()')
        self.set_size_request(250, 100)
        FlatCAMApp.App.log.debug('self.set_size_request(250, 100)')
        textview = Gtk.TextView()
        #print textview
        #FlatCAMApp.App.log.debug('self.textview = Gtk.TextView()')
        #self.textbuffer = self.textview.get_buffer()
        #FlatCAMApp.App.log.debug('self.textbuffer = self.textview.get_buffer()')
        #self.textbuffer.set_text("(Nothing here!)")
        #FlatCAMApp.App.log.debug('self.textbuffer.set_text("(Nothing here!)")')
        #self.add(self.textview)
        #FlatCAMApp.App.log.debug('self.add(self.textview)')
        #self.show() 
开发者ID:Denvi,项目名称:FlatCAM,代码行数:19,代码来源:GUIElements.py

示例4: error_callback

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import TextView [as 别名]
def error_callback(self, msg):
    def f():
      dialogWindow = Gtk.MessageDialog(self.win,
                            Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
                            Gtk.MessageType.INFO,
                            Gtk.ButtonsType.OK,
                            '\nGnomecast encountered an error converting your file.')
      dialogWindow.set_title('Transcoding Error')
      dialogWindow.set_default_size(1, 400)
      
      dialogBox = dialogWindow.get_content_area()
      buffer1 = Gtk.TextBuffer()
      buffer1.set_text(msg)
      text_view = Gtk.TextView(buffer=buffer1)
      text_view.set_editable(False)
      scrolled_window = Gtk.ScrolledWindow()
      scrolled_window.set_border_width(5)
      # we scroll only if needed
      scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
      scrolled_window.add(text_view)
      dialogBox.pack_end(scrolled_window, True, True, 0)
      dialogWindow.show_all()
      response = dialogWindow.run()
      dialogWindow.destroy()
    GLib.idle_add(f) 
开发者ID:keredson,项目名称:gnomecast,代码行数:27,代码来源:gnomecast.py

示例5: showOutput

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import TextView [as 别名]
def showOutput(self, widget):           # Request for daemon output
            widget.set_sensitive(False)                         # Disable menu item


            def displayOutput(outText, widget):
                # # # NOTE: it is called not from main thread, so it have to add action in main loop queue
                def do_display(outText, widget):
                    # global APPLOGO
                    statusWindow = Gtk.Dialog(_('Yandex.Disk daemon output message'))
                    statusWindow.set_icon(APPLOGO)
                    statusWindow.set_border_width(6)
                    statusWindow.add_button(_('Close'), Gtk.ResponseType.CLOSE)
                    textBox = Gtk.TextView()                            # Create text-box to display daemon output
                    # Set output buffer with daemon output in user language
                    textBox.get_buffer().set_text(outText)
                    textBox.set_editable(False)
                    # Put it inside the dialogue content area
                    statusWindow.get_content_area().pack_start(textBox, True, True, 6)
                    statusWindow.show_all();  statusWindow.run();   statusWindow.destroy()
                    widget.set_sensitive(True)                          # Enable menu item
                idle_add(do_display, outText, widget)

            self.daemon.output(lambda t: displayOutput(t, widget)) 
开发者ID:slytomcat,项目名称:yandex-disk-indicator,代码行数:25,代码来源:indicator.py

示例6: ScrolledTextView

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import TextView [as 别名]
def ScrolledTextView(text=None, monospace=False, **kwarg):
	'''Initializes a C{Gtk.TextView} with sane defaults for displaying a
	piece of multiline text and wraps it in a scrolled window

	@param text: initial text to show in the textview
	@param monospace: when C{True} the font will be set to monospaced
	and line wrapping disabled, use this to display log files etc.
	@param kwarg: arguments passed on to L{ScrolledWindow}
	@returns: a 2-tuple of the scrolled window and the textview
	'''
	textview = Gtk.TextView()
	textview.set_editable(False)
	textview.set_left_margin(5)
	textview.set_right_margin(5)
	if monospace:
		font = Pango.FontDescription('Monospace')
		textview.modify_font(font)
	else:
		textview.set_wrap_mode(Gtk.WrapMode.WORD)

	if text:
		textview.get_buffer().set_text(text)
	window = ScrolledWindow(textview, **kwarg)
	return window, textview 
开发者ID:zim-desktop-wiki,项目名称:zim-desktop-wiki,代码行数:26,代码来源:widgets.py

示例7: __add_scrolled_window

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import TextView [as 别名]
def __add_scrolled_window(self):
        text = Gtk.TextView()
        text.get_buffer().set_text(self.scrolled_text)
        text.set_wrap_mode(Gtk.WrapMode.WORD)
        text.set_editable(False)

        scrolledwindow = ScrolledWindow()
        scrolledwindow.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        scrolledwindow.add_with_viewport(text)
        scrolledwindow.set_size_request(400, 200)
        scrolledwindow.apply_styling_to_widget(wide=False)

        return scrolledwindow 
开发者ID:KanoComputing,项目名称:kano-toolset,代码行数:15,代码来源:kano_dialog.py

示例8: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import TextView [as 别名]
def __init__(self, *args, **kwargs):
		Gtk.Frame.__init__(self, *args, **kwargs)
		self.get_style_context().add_class('multilineentry')
		textview = Gtk.TextView()
		self.add(textview) 
开发者ID:rsmusllp,项目名称:king-phisher,代码行数:7,代码来源:extras.py

示例9: set_monospace_font

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import TextView [as 别名]
def set_monospace_font(text_view):
    """
    Set the font to monospace in the text view
    :param text_view: A GTK TextView
    """
    try:
        import pango

        font_desc = pango.FontDescription('monospace 11')
        if font_desc:
            text_view.modify_font(font_desc)
    except ImportError:
        pass 
开发者ID:textext,项目名称:textext,代码行数:15,代码来源:asktext.py

示例10: create_about_tab

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import TextView [as 别名]
def create_about_tab(self):
        from gi.repository import Pango
        page = Gtk.VBox()
        page.show()
        tv = Gtk.TextView()
        tv.set_editable(False)
        tv.set_cursor_visible(False)
        tv.modify_font(Pango.FontDescription(MONOSPACE_FONT))
        scroll = Gtk.ScrolledWindow()
        scroll.add(tv)
        page.pack_start(scroll, True, True, 0)
        self.info = tv.get_buffer()
        self.add_tab(page, 'Wall') 
开发者ID:mazaclub,项目名称:encompass,代码行数:15,代码来源:gtk.py

示例11: init

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import TextView [as 别名]
def init(self):
        """
        Constructs the GUI, consisting of a text area, and
        an Import and Clear buttons.
        """
        from gi.repository import Gtk
        # GUI setup:
        self.set_tooltip(_("Enter text to import and then click\n"
                           "the Import button at bottom"))
        # create
        self.import_text = Gtk.TextView()
        self.import_text.set_wrap_mode(Gtk.WrapMode.NONE)
        self.import_text.set_editable(True)
        import_button = Gtk.Button()
        clear_button = Gtk.Button()
        # layout
        scrolled_window = Gtk.ScrolledWindow()
        scrolled_window.add(self.import_text)
        buttonbox = Gtk.HButtonBox()
        buttonbox.set_layout(Gtk.ButtonBoxStyle.SPREAD)
        buttonbox.pack_start(clear_button, False, False, 0)
        buttonbox.pack_start(import_button, False, False, 0)
        vbox = Gtk.VBox()
        vbox.pack_start(scrolled_window, True, True, 0)
        vbox.pack_start(buttonbox, False, False, 0)
        scrolled_window = self.gui.get_container_widget()
        for widget in scrolled_window.get_children():
            widget.destroy()
        scrolled_window.add_with_viewport(vbox)
        scrolled_window.get_children()[0].set_shadow_type(Gtk.ShadowType.NONE)
        # bindings
        actiongroup = Gtk.ActionGroup('GrampletImportActions')
        actiongroup.add_actions([
            ('import', None, _("_Import"), '<Alt>i', None, self.run),
            ('clear', Gtk.STOCK_CLEAR, None, None, None, self.clear)])
        import_button.set_related_action(actiongroup.get_action('import'))
        clear_button.set_related_action(actiongroup.get_action('clear'))
        # show
        vbox.show_all() 
开发者ID:gramps-project,项目名称:addons-source,代码行数:41,代码来源:ImportGramplet.py

示例12: __add_text_view

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import TextView [as 别名]
def __add_text_view(self, name):
        """
        Add a text view to the interface.
        """
        label = Gtk.Label(halign=Gtk.Align.START)
        label.set_markup('<b>%s</b>' % name)
        self.top.pack_start(label, False, False, 6)
        swin = Gtk.ScrolledWindow()
        swin.set_shadow_type(Gtk.ShadowType.IN)
        tview = Gtk.TextView()
        swin.add(tview)
        self.top.pack_start(swin, True, True, 6)
        return tview.get_buffer() 
开发者ID:gramps-project,项目名称:addons-source,代码行数:15,代码来源:DateCalculator.py

示例13: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import TextView [as 别名]
def __init__(self):
        View.__init__(self)

        self._lock = threading.Lock()

        self.text_view = Gtk.TextView()
        self.text_view.set_property('editable', False)

        self.filtered_buffer = self.create_text_buffer()

        self.text_view.set_buffer(self.filtered_buffer)

        self.text_view.set_border_window_size(Gtk.TextWindowType.LEFT, 10)
        self.text_view.set_border_window_size(Gtk.TextWindowType.RIGHT, 10)
        self.text_view.set_border_window_size(Gtk.TextWindowType.TOP, 10)
        self.text_view.set_border_window_size(Gtk.TextWindowType.BOTTOM, 10)

        self._enables = {}
        self._auto_scroll_handler_id = None

        scrollable = Gtk.ScrolledWindow()
        scrollable.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        scrollable.set_name('console_scroller')
        scrollable.add(self.text_view)
        self.text_view.show()

        self['scrollable'] = scrollable
        self.top = 'scrollable'
        self.quit_flag = False

        self.logging_priority = global_gui_config.get_config_value("LOGGING_CONSOLE_GTK_PRIORITY", GLib.PRIORITY_LOW)

        self._stored_line_number = None
        self._stored_line_offset = None
        self._stored_text_of_line = None
        self._stored_relative_lines = None 
开发者ID:DLR-RM,项目名称:RAFCON,代码行数:38,代码来源:logging_console.py

示例14: load

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import TextView [as 别名]
def load(self, gmwidg):
        # Specify whether the panel should have a horizontal layout:
        horizontal = True

        if horizontal:
            self.box = Gtk.HBox()
        else:
            self.box = Gtk.VBox()
        __widget__ = self.box

        # Use two engine output widgets for each player color:
        self.output_white = EngineOutput(True)
        self.output_black = EngineOutput(False)
        if horizontal:
            self.output_separator = Gtk.VSeparator()
        else:
            self.output_separator = Gtk.HSeparator()

        self.output_noengines = Gtk.TextView()
        self.output_noengines.get_buffer().set_text(_(
            "No chess engines (computer players) are participating in this game."))
        self.output_noengines.set_editable(False)
        self.output_noengines.set_wrap_mode(Gtk.WrapMode.WORD_CHAR)

        __widget__.pack_start(self.output_noengines, True, True, 0)
        __widget__.show_all()

        self.boardview = gmwidg.board.view

        self.model_cids = [
            self.boardview.model.connect_after("game_changed", self.game_changed),
            self.boardview.model.connect_after("players_changed", self.players_changed),
            self.boardview.model.connect_after("game_started", self.game_started),
            self.boardview.model.connect_after("game_terminated", self.on_game_terminated),
        ]
        return __widget__ 
开发者ID:pychess,项目名称:pychess,代码行数:38,代码来源:engineOutputPanel.py

示例15: onNewsItem

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import TextView [as 别名]
def onNewsItem(self, nm, news):
        weekday, month, day, title, details = news

        dtitle = "%s, %s %s: %s" % (weekday, month, day, title)
        label = Gtk.Label(label=dtitle)
        label.props.width_request = 300
        label.props.xalign = 0
        label.set_ellipsize(Pango.EllipsizeMode.END)
        expander = Gtk.Expander()
        expander.set_label_widget(label)
        expander.set_tooltip_text(title)
        textview = Gtk.TextView()
        textview.set_wrap_mode(Gtk.WrapMode.WORD)
        textview.set_editable(False)
        textview.set_cursor_visible(False)
        textview.props.pixels_above_lines = 4
        textview.props.pixels_below_lines = 4
        textview.props.right_margin = 2
        textview.props.left_margin = 6

        tb_iter = textview.get_buffer().get_end_iter()
        insert_formatted(textview, tb_iter, details)

        alignment = Gtk.Alignment()
        alignment.set_padding(3, 6, 12, 0)
        alignment.props.xscale = 1
        alignment.add(textview)

        expander.add(alignment)
        expander.show_all()
        self.widgets["newsVBox"].pack_start(expander, False, False, 0) 
开发者ID:pychess,项目名称:pychess,代码行数:33,代码来源:NewsPanel.py


注:本文中的gi.repository.Gtk.TextView方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。