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


Python pango.FontDescription方法代码示例

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


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

示例1: __init__

# 需要导入模块: import pango [as 别名]
# 或者: from pango import FontDescription [as 别名]
def __init__(self, db, gui):

        trace = vdb.VdbTrace(db)
        self.db = db

        # The vdb instance *is* the cli object.
        vw_windows.MainWindow.__init__(self, db, trace, syms=trace)

        self.gui = gui
        self.set_title("Vdb")
        self.menubar.addField("File.Save.Layout", self.file_save_layout)
        self.menubar.addField("File.Save.Snapshot", self.file_save_snapshot)
        self.menubar.addField("File.Quit", self.file_quit)
        self.menubar.addField("Edit.Copy", self.file_edit_copy)
        self.menubar.addField("View.Memory Window", self.file_view_memwin)
        self.menubar.addField("View.Memory Maps", self.file_view_memmaps)
        self.menubar.addField("View.Registers", self.file_view_registers)
        self.menubar.addField("View.File Descriptors", self.file_view_filedesc)
        self.menubar.addField("Tools.Python", self.tools_python)

        # On delete, lets save off the layout...
        self.connect('delete_event', self._mainDelete)

        #descr = pango.FontDescription("Monospace 12")
        #entry.modify_font(descr) 
开发者ID:joxeankoret,项目名称:nightmare,代码行数:27,代码来源:__init__.py

示例2: _start_shell

# 需要导入模块: import pango [as 别名]
# 或者: from pango import FontDescription [as 别名]
def _start_shell(self, dummy_button):
        if self.shell_window is not None:
            self.shell_window.present()
            return
        
        self.shell_window = gtk.Window()
        self.shell_window.set_size_request(750,550)
        self.shell_window.set_resizable(True)
        scrolled_window = gtk.ScrolledWindow()
        scrolled_window.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
        ipython = ipython_view.IPythonView()
        ipython.modify_font(pango.FontDescription(SHELL_FONT))
        ipython.set_wrap_mode(gtk.WRAP_CHAR)
        ipython.show()
        scrolled_window.add(ipython)
        scrolled_window.show()
        self.shell_window.add(scrolled_window)
        self.shell_window.show()
        self.shell_window.connect('destroy', self._on_shell_window_destroy)

        self._update_ipython_selected_node()
        __IPYTHON__.user_ns['viz'] = self 
开发者ID:ntu-dsi-dcn,项目名称:ntu-dsi-dcn,代码行数:24,代码来源:core.py

示例3: __init__

# 需要导入模块: import pango [as 别名]
# 或者: from pango import FontDescription [as 别名]
def __init__(self):
    gtk.TextView.__init__(self)
    self.modify_font(pango.FontDescription('Mono'))
    self.set_cursor_visible(True)
    self.text_buffer = self.get_buffer()
    self.mark = self.text_buffer.create_mark('scroll_mark',
                                             self.text_buffer.get_end_iter(),
                                             False)
    for code in ansi_colors:
      self.text_buffer.create_tag(code,
                                  foreground=ansi_colors[code],
                                  weight=700)
    self.text_buffer.create_tag('0')
    self.text_buffer.create_tag('notouch', editable=False)
    self.color_pat = re.compile('\x01?\x1b\[(.*?)m\x02?')
    self.line_start = \
                self.text_buffer.create_mark('line_start',
                        self.text_buffer.get_end_iter(), True
                )
    self.connect('key-press-event', self._onKeypress)
    self.last_cursor_pos = 0 
开发者ID:ntu-dsi-dcn,项目名称:ntu-dsi-dcn,代码行数:23,代码来源:ipython_view.py

示例4: _start_shell

# 需要导入模块: import pango [as 别名]
# 或者: from pango import FontDescription [as 别名]
def _start_shell(self, dummy_button):
        if self.shell_window is not None:
            self.shell_window.present()
            return
        
        self.shell_window = gtk.Window()
        self.shell_window.set_size_request(750,550)
        self.shell_window.set_resizable(True)
        scrolled_window = gtk.ScrolledWindow()
        scrolled_window.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
        self.ipython = ipython_view.IPythonView()
        self.ipython.modify_font(pango.FontDescription(SHELL_FONT))
        self.ipython.set_wrap_mode(gtk.WRAP_CHAR)
        self.ipython.show()
        scrolled_window.add(self.ipython)
        scrolled_window.show()
        self.shell_window.add(scrolled_window)
        self.shell_window.show()
        self.shell_window.connect('destroy', self._on_shell_window_destroy)

        self._update_ipython_selected_node()
        self.ipython.updateNamespace({'viz': self}) 
开发者ID:imec-idlab,项目名称:IEEE-802.11ah-ns-3,代码行数:24,代码来源:core.py

示例5: __init__

# 需要导入模块: import pango [as 别名]
# 或者: from pango import FontDescription [as 别名]
def __init__(self):
    '''
    Initialize console view.
    '''
    gtk.TextView.__init__(self)
    self.modify_font(pango.FontDescription('Mono'))
    self.set_cursor_visible(True)
    self.text_buffer = self.get_buffer()
    self.mark = self.text_buffer.create_mark('scroll_mark',
                                             self.text_buffer.get_end_iter(),
                                             False)
    for code in self.ANSI_COLORS:
      self.text_buffer.create_tag(code, 
                                  foreground=self.ANSI_COLORS[code], 
                                  weight=700)
    self.text_buffer.create_tag('0')
    self.text_buffer.create_tag('notouch', editable=False)
    self.color_pat = re.compile('\x01?\x1b\[(.*?)m\x02?')
    self.line_start = \
        self.text_buffer.create_mark('line_start', 
                                     self.text_buffer.get_end_iter(), True)
    self.connect('key-press-event', self.onKeyPress) 
开发者ID:imec-idlab,项目名称:IEEE-802.11ah-ns-3,代码行数:24,代码来源:ipython_view.py

示例6: __init__

# 需要导入模块: import pango [as 别名]
# 或者: from pango import FontDescription [as 别名]
def __init__(self):
    """
    Initialize console view.
    """
    gtk.TextView.__init__(self)
    self.modify_font(pango.FontDescription('Mono'))
    self.set_cursor_visible(True)
    self.text_buffer = self.get_buffer()
    self.mark = self.text_buffer.create_mark('scroll_mark',
                                             self.text_buffer.get_end_iter(),
                                             False)
    for code in self.ANSI_COLORS:
      self.text_buffer.create_tag(code, 
                                  foreground=self.ANSI_COLORS[code], 
                                  weight=700)
    self.text_buffer.create_tag('0')
    self.text_buffer.create_tag('notouch', editable=False)
    self.color_pat = re.compile('\x01?\x1b\[(.*?)m\x02?')
    self.line_start = \
        self.text_buffer.create_mark('line_start', 
                                     self.text_buffer.get_end_iter(), True)
    self.connect('key-press-event', self.onKeyPress) 
开发者ID:KTH,项目名称:royal-chaos,代码行数:24,代码来源:ipython_view.py

示例7: show_font_dialog

# 需要导入模块: import pango [as 别名]
# 或者: from pango import FontDescription [as 别名]
def show_font_dialog(parent, title, button):
    if not hasattr(parent, 'dlgFont'):
        parent.dlgFont = None
        
    if parent.dlgFont == None:
        parent.dlgFont = gtk.FontSelectionDialog(title)
    fontsel = parent.dlgFont.fontsel
    fontsel.set_font_name(button.selected_font.to_string())    

    response = parent.dlgFont.run()

    if response == gtk.RESPONSE_OK:        
        button.selected_font = pango.FontDescription(fontsel.get_font_name())        
        button.set_label(button.selected_font.to_string())
        button.get_child().modify_font(button.selected_font)
    parent.dlgFont.hide() 
开发者ID:mjun,项目名称:gnome-connection-manager,代码行数:18,代码来源:gnome_connection_manager.py

示例8: cairo_font

# 需要导入模块: import pango [as 别名]
# 或者: from pango import FontDescription [as 别名]
def cairo_font(tk_font):
  family, size, weight = tk_font
  return pango.FontDescription('{} {} {}'.format(family, weight, size)) 
开发者ID:kevinpt,项目名称:symbolator,代码行数:5,代码来源:cairo_backend.py

示例9: zoom_orig

# 需要导入模块: import pango [as 别名]
# 或者: from pango import FontDescription [as 别名]
def zoom_orig(self):
        """Restore original font size"""
        if self.config['use_system_font'] == True:
            font = self.config.get_system_font()
        else:
            font = self.config['font']
        dbg("Terminal::zoom_orig: restoring font to: %s" % font)
        self.set_font(pango.FontDescription(font))
        self.custom_font_size = None 
开发者ID:OWASP,项目名称:NINJA-PingU,代码行数:11,代码来源:terminal.py

示例10: __init__

# 需要导入模块: import pango [as 别名]
# 或者: from pango import FontDescription [as 别名]
def __init__(self, db):
        vw_windows.VWindow.__init__(self, os.path.join(vdb.basepath,"glade","Win32Heap.glade"), None)
        self.vdb = db
        self.font = pango.FontDescription("Monospace 10")
        self.setupHeapTree()
        self.setupChunkList()
        self.spaceview = vwidget.SpaceView([], dwidth=40)
        hb = self.getWidget("hbox1")
        hb.pack_start(self.spaceview, expand=False)
        self.spaceview.show()
        hb.resize_children() 
开发者ID:joxeankoret,项目名称:nightmare,代码行数:13,代码来源:windows.py

示例11: _get_pango_layout

# 需要导入模块: import pango [as 别名]
# 或者: from pango import FontDescription [as 别名]
def _get_pango_layout(self, s, prop):
        """
        Create a pango layout instance for Text 's' with properties 'prop'.
        Return - pango layout (from cache if already exists)

        Note that pango assumes a logical DPI of 96
        Ref: pango/fonts.c/pango_font_description_set_size() manual page
        """
        # problem? - cache gets bigger and bigger, is never cleared out
        # two (not one) layouts are created for every text item s (then they
        # are cached) - why?

        key = self.dpi, s, hash(prop)
        value = self.layoutd.get(key)
        if value != None:
            return value

        size = prop.get_size_in_points() * self.dpi / 96.0
        size = round(size)

        font_str = '%s, %s %i' % (prop.get_name(), prop.get_style(), size,)
        font = pango.FontDescription(font_str)

        # later - add fontweight to font_str
        font.set_weight(self.fontweights[prop.get_weight()])

        layout = self.gtkDA.create_pango_layout(s)
        layout.set_font_description(font)
        inkRect, logicalRect = layout.get_pixel_extents()

        self.layoutd[key] = layout, inkRect, logicalRect
        return layout, inkRect, logicalRect 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:34,代码来源:backend_gdk.py

示例12: set_monospace_font

# 需要导入模块: import pango [as 别名]
# 或者: from pango import FontDescription [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


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