本文整理汇总了Python中console.Console.set_font方法的典型用法代码示例。如果您正苦于以下问题:Python Console.set_font方法的具体用法?Python Console.set_font怎么用?Python Console.set_font使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类console.Console
的用法示例。
在下文中一共展示了Console.set_font方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: AndroidPlugin
# 需要导入模块: from console import Console [as 别名]
# 或者: from console.Console import set_font [as 别名]
class AndroidPlugin(GObject.Object, Gedit.WindowActivatable):
__gtype_name__ = "GeditAndroidPlugin"
window = GObject.property(type=Gedit.Window)
def __init__(self):
GObject.Object.__init__(self)
self._ui_merge_id = None
self._console = None
self._project = None
def _add_console(self):
""" Adds a widget to the bottom pane for command output. """
self._console = Console()
self._console.set_font(self._settings.get_string("console-font"))
panel = self.window.get_bottom_panel()
panel.add_item_with_stock_icon(self._console, "AndroidConsole",
"Console", STOCK_CONSOLE)
def _add_ui(self):
""" Merge the 'Android' 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("AndroidGlobal")
self._global_actions.add_actions([
('Android', None, "_Android", None, None, None),
('AndroidNewProject', Gtk.STOCK_NEW, "_New Project...",
"<Shift><Control>N", "Start a new Android project.",
self.on_new_project_activate),
('AndroidOpenProject', Gtk.STOCK_OPEN, "_Open Project",
"<Shift><Control>O", "Open an existing Android project.",
self.on_open_project_activate),
('AndroidSdk', STOCK_SDK, "Android _SDK Manager",
None, "Launch the Android SDK manager.",
self.on_android_sdk_activate),
('AndroidAvdManager', STOCK_AVD, "_AVD Manager",
None, "Launch the Android AVD manager.",
self.on_android_avd_manager_activate),
])
manager.insert_action_group(self._global_actions)
# project actions are sensitive when a project is open
self._project_actions = Gtk.ActionGroup("AndroidProject")
self._project_actions.add_actions([
('AndroidCloseProject', Gtk.STOCK_CLOSE, "_Close Project...",
"", "Close the current Android project.",
self.on_close_project_activate),
('AndroidRun', None, "_Run...",
"", "Run the current project in debug mode.",
self.on_run_activate),
])
self._project_actions.set_sensitive(False)
manager.insert_action_group(self._project_actions)
self._ui_merge_id = manager.add_ui_from_file(ui_file)
manager.ensure_update()
def build_project(self, mode="debug"):
try:
self._console.run("%s %s" %
(self._settings.get_string("ant-command"), mode),
self._project.get_path())
except Exception as e:
self.error_dialog(str(e))
def close_project(self):
self._project = None
self._project_actions.set_sensitive(False)
def do_activate(self):
""" Plugin activates at startup and/or gedit preferences. """
# make sure we can use settings
schemas = Gio.Settings.list_schemas()
if not SETTINGS_SCHEMA in schemas:
self.error_dialog("Could not find settings schema:\n %s" % SETTINGS_SCHEMA)
return
self._settings = Gio.Settings.new(SETTINGS_SCHEMA)
self._install_stock_icons()
self._add_ui()
self._add_console()
def do_deactivate(self):
""" Plugin deactivates at startup and/or gedit preferences. """
self._settings = None
self._remove_ui()
self._remove_console()
def do_update_state(self):
pass
def error_dialog(self, message):
""" Display a very basic error dialog. """
logger.warn(message)
dialog = Gtk.MessageDialog(self.window,
Gtk.DialogFlags.MODAL |
Gtk.DialogFlags.DESTROY_WITH_PARENT,
Gtk.MessageType.ERROR, Gtk.ButtonsType.OK,
#.........这里部分代码省略.........