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


Python Application.run方法代码示例

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


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

示例1: WorkListApp

# 需要导入模块: from dtk.ui.application import Application [as 别名]
# 或者: from dtk.ui.application.Application import run [as 别名]
class WorkListApp(gobject.GObject):
	def __init__(self):
		gobject.GObject.__init__(self)
		
		self.app = Application(False)
		self.app.window.set_size_request(500, 300)
		# Add app titlebar.
		self.app.add_titlebar(["theme", "menu", "max", "min", "close"],
								None, "WorkList for Deepin", " ", 
								add_separator = True)        
		self.app.set_icon(app_theme.get_pixbuf('icon/worklist.png'))
		self.app.set_skin_preview(app_theme.get_pixbuf('frame.png'))

		self.win = self.app.window
		self.win.set_resizable(False)
		self.app.run()
开发者ID:hualet,项目名称:deepin-ui-worklist,代码行数:18,代码来源:instance.py

示例2: Application

# 需要导入模块: from dtk.ui.application import Application [as 别名]
# 或者: from dtk.ui.application.Application import run [as 别名]
    # Init application.
    application = Application()

    # Set application default size.
    application.set_default_size(DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT)

    # Set application icon.
    application.set_icon(os.path.join(get_current_dir(__file__), "icon.ico"))
    
    # Set application preview pixbuf.
    application.set_skin_preview(os.path.join(get_current_dir(__file__), "frame.png"))
    
    # Add titlebar.
    application.add_titlebar(
        ["theme", "max", "min", "close"], 
        os.path.join(get_current_dir(__file__), "logo.png"), 
        "Tab demo",
        "Tab demo",
        )
    
    tabbox = TabBox()
    align = gtk.Alignment()
    align.set(0.5, 0.5, 1, 1)
    align.set_padding(2, 2, 2, 2)
    align.add(tabbox)
    
    
    application.main_box.pack_start(align)

    application.run()
开发者ID:Jiarui315,项目名称:deepin-ui,代码行数:32,代码来源:tab_demo.py

示例3: UpdateManager

# 需要导入模块: from dtk.ui.application import Application [as 别名]
# 或者: from dtk.ui.application.Application import run [as 别名]

#.........这里部分代码省略.........

    def draw_mask(self, cr, x, y, w, h):
        sidebar_color = ui_theme.get_color("menu_select_font").get_color()
        draw_vlinear(cr, x, y, w, h,
                     [(0, (sidebar_color, 0.9)),
                      (1, (sidebar_color, 0.9)),]
                     )

    def start_dsc_backend(self):
        self.system_bus = dbus.SystemBus()
        bus_object = self.system_bus.get_object(DSC_SERVICE_NAME, DSC_SERVICE_PATH)
        self.bus_interface = dbus.Interface(bus_object, DSC_SERVICE_NAME)
        self.system_bus.add_signal_receiver(
                self.backend_signal_receiver, 
                signal_name="update_signal", 
                dbus_interface=DSC_SERVICE_NAME, 
                path=DSC_SERVICE_PATH)

    def backend_signal_receiver(self, messages):
        for message in messages:
            (signal_type, action_content) = message
            
            if signal_type == "update-list-update":
                self.in_update_list = True
                message_str = "正在检查更新,请稍等...(%s%%)" % int(float(action_content[0]))
                self.update_info_label.set_text(message_str)
                self.upgrade_button.set_sensitive(False)
            elif signal_type == 'update-list-finish':
                message_str = "正在检查更新,请稍等..."
                self.update_info_label.set_text(message_str)
                self.in_update_list = False

                self.bus_interface.request_upgrade_pkgs(
                        reply_handler=self.render_upgrade_info, 
                        error_handler=lambda e:handle_dbus_error("request_upgrade_pkgs", e))
            elif signal_type == 'update-list-failed':
                message_str = '检查更新失败!'
                self.update_info_label.set_text(message_str)

            elif signal_type == 'upgrade-commit-update':
                pkg_names, action_type, percent, status = action_content
                message_str = "[%s%%]%s" % (percent, status)
                self.update_info_label.set_text(message_str)
                self.upgrade_button.set_sensitive(False)
                self.in_upgrade_packages = True

            elif signal_type == 'upgrade-commit-finish':
                self.in_upgrade_packages = False
                message_str = '软件更新完成!'
                self.update_info_label.set_text(message_str)

    def upgrade_packages(self, widget):
        if self.in_update_list:
            print 'Check update, please wait...'
        elif self.in_upgrade_packages:
            print 'Upgrade packages, please wait...'
        else:
            self.upgrade_button.set_sensitive(False)
            self.in_upgrade_packages = True
            all_upgrade_pkgs = []
            for info in self.upgrade_pkg_infos:
                all_upgrade_pkgs.append(str(eval(info)[0]))
            self.bus_interface.upgrade_pkgs_with_new_policy(
                    all_upgrade_pkgs,
                    reply_handler=lambda :handle_dbus_reply("upgrade_pkgs_with_new_policy"), 
                    error_handler=lambda e:handle_dbus_error("upgrade_pkgs_with_new_policy", e),
                    )

    def render_upgrade_info(self, pkg_infos):
        self.upgrade_pkg_infos = pkg_infos
        if len(pkg_infos) > 0:
            msg_str = '您的系统有%s个更新!' % (len(pkg_infos),)
            self.upgrade_button.set_sensitive(True)
        else:
            msg_str = '您的系统已经最新状态了~'
            self.upgrade_button.set_sensitive(False)

        self.update_info_label.set_text(msg_str)
        self.application.window.show_all()

    def run(self):
        self.start_dsc_backend()
        container_remove_all(self.background)
        self.background.pack_start(self.update_info_label_align)

        gtk.timeout_add(1000, lambda:self.bus_interface.start_update_list(
                reply_handler=lambda :handle_dbus_reply("start_update_list"),
                error_handler=lambda e:handle_dbus_error("start_update_list", e)))

        self.application.run()
        self.bus_interface.request_quit(
                reply_handler=lambda :handle_dbus_reply("request_quit"), 
                error_handler=lambda e:handle_dbus_error("request_quit", e))

    def quit(self):
        gtk.main_quit()

    @dbus.service.method(DSC_UPDATE_MANAGER_NAME, in_signature="", out_signature="")    
    def hello(self):
        self.application.window.present()
开发者ID:iceleaf916,项目名称:software-update-manager,代码行数:104,代码来源:main.py


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