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


Python Shell.set_font方法代码示例

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


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

示例1: Plugin

# 需要导入模块: from shell import Shell [as 别名]
# 或者: from shell.Shell import set_font [as 别名]
class Plugin(GObject.Object, Gedit.WindowActivatable):
    __gtype_name__ = "GeditDjangoProjectPlugin"
    window = GObject.property(type=Gedit.Window)
    
    def __init__(self):
        GObject.Object.__init__(self)
        self._project = None
        self._server = None
        self._output = None
        self._shell = None
        self._dbshell = None
        self._install_stock_icons()
        self._admin_cmd = "django-admin.py" 
        self._manage_cmd = "python manage.py"
        self._font = "monospace 10"
    
    def _add_dbshell_panel(self):
        """ Adds a database shell to the bottom pane. """
        logger.debug("Adding database shell panel.")
        self._dbshell = Shell()
        self._dbshell.set_font(self._font)
        panel = self.window.get_bottom_panel()
        panel.add_item_with_stock_icon(self._dbshell, "DjangoDbShell", 
                                       "Database Shell", STOCK_DBSHELL)
        self._setup_dbshell_panel()
        panel.activate_item(self._dbshell)
                                       
    def _add_output_panel(self):
        """ Adds a widget to the bottom pane for django command output. """
        self._output = OutputBox()
        self._output.set_font(self._font)
        panel = self.window.get_bottom_panel()
        panel.add_item_with_stock_icon(self._output, "DjangoOutput", 
                                       "Django Output", Gtk.STOCK_EXECUTE)
        
    def _add_server_panel(self, cwd=None):
        """ Adds a VTE widget to the bottom pane for development server. """
        logger.debug("Adding server panel.")
        self._server = DjangoServer()
        self._server.set_font(self._font)
        self._server.command = "%s runserver" % (self._manage_cmd)
        if cwd:
            self._server.cwd = cwd
        self._server.connect("server-started", self.on_server_started)
        self._server.connect("server-stopped", self.on_server_stopped)
        panel = self.window.get_bottom_panel()
        panel.add_item_with_stock_icon(self._server, "DjangoServer", 
                                       "Django Server", STOCK_SERVER)
        self._setup_server_panel()
    
    def _add_shell_panel(self):
        """ Adds a python shell to the bottom pane. """
        logger.debug("Adding shell.")
        self._shell = Shell()
        self._shell.set_font(self._font)
        panel = self.window.get_bottom_panel()
        panel.add_item_with_stock_icon(self._shell, "DjangoShell", 
                                       "Python Shell", STOCK_PYTHON)
        self._setup_shell_panel()
        panel.activate_item(self._shell)
                                       
    def _add_ui(self):
        """ Merge the 'Django' menu into the Gedit menubar. """
        ui_file = os.path.join(DATA_DIR, 'menu.ui')
        manager = self.window.get_ui_manager()
        
        # global actions are always sensitive
        self._global_actions = Gtk.ActionGroup("DjangoGlobal")
        self._global_actions.add_actions([
            ('Django', None, "_Django", None, None, None),
            ('NewProject', Gtk.STOCK_NEW, "_New Project...", 
                "<Shift><Control>N", "Start a new Django project.", 
                self.on_new_project_activate),
            ('OpenProject', Gtk.STOCK_OPEN, "_Open Project", 
                "<Shift><Control>O", "Open an existing Django project.", 
                self.on_open_project_activate),
            ('NewApp', Gtk.STOCK_NEW, "New _App...", 
                "<Shift><Control>A", "Start a new Django application.", 
                self.on_new_app_activate),
        ])
        self._global_actions.add_toggle_actions([
            ('ViewServerPanel', None, "Django _Server", 
                None, "Add the Django development server to the bottom panel.", 
                self.on_view_server_panel_activate, True),
            ('ViewPythonShell', None, "_Python Shell", 
                None, "Add a Python shell to the bottom panel.", 
                self.on_view_python_shell_panel_activate, False),
            ('ViewDbShell', None, "_Database Shell", 
                None, "Add a Database shell to the bottom panel.", 
                self.on_view_db_shell_panel_activate, False),
        ])
        manager.insert_action_group(self._global_actions)       
        
        # project actions are sensitive when a project is open
        self._project_actions = Gtk.ActionGroup("DjangoProject")
        self._project_actions.add_actions([
            ('CloseProject', Gtk.STOCK_CLOSE, "_Close Project...", 
                "", "Close the current Django project.", 
                self.on_close_project_activate),
            ('Manage', None, "_Manage", None, None, None),
#.........这里部分代码省略.........
开发者ID:Kalviy,项目名称:gedit-django-project,代码行数:103,代码来源:plugin.py


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