本文整理匯總了Python中dtk.ui.application.Application.set_icon方法的典型用法代碼示例。如果您正苦於以下問題:Python Application.set_icon方法的具體用法?Python Application.set_icon怎麽用?Python Application.set_icon使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類dtk.ui.application.Application
的用法示例。
在下文中一共展示了Application.set_icon方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: WorkListApp
# 需要導入模塊: from dtk.ui.application import Application [as 別名]
# 或者: from dtk.ui.application.Application import set_icon [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()
示例2: GUI
# 需要導入模塊: from dtk.ui.application import Application [as 別名]
# 或者: from dtk.ui.application.Application import set_icon [as 別名]
class GUI(object):
'''Media Player GUI kernel code.核心界麵代碼'''
def __init__(self):
'''application.'''
self.app = Application(False)
# application set.
self.app.set_default_size(800, 500)
# self.app.window.resize
self.app.set_icon(app_theme.get_pixbuf("icon.ico"))
self.app.set_skin_preview(app_theme.get_pixbuf("frame.png"))
# set titlebar.
self.app.add_titlebar(["theme", "menu", "max", "min", "close"],
app_theme.get_pixbuf("logo.png"),
_("Deepin Media Player"), " ",
add_separator = False)
#
self.main_ali = gtk.Alignment()
self.main_vbox = gtk.VBox()
self.main_ali.add(self.main_vbox)
self.main_ali.set(0, 0, 1.0, 1.0)
self.main_ali.set_padding(0, 2, 2, 2)
'''movie screen. 電影播放屏幕.'''
# 播放屏幕和播放列表的HBOX.
self.screen_and_play_list_hbox = gtk.HBox()
self.screen_frame = gtk.Alignment(0.0, 0.0, 1.0, 1.0)
self.screen = gtk.DrawingArea()
self.screen_frame.add(self.screen)
#
self.play_list = gtk.Button("播放列表")
#
self.screen_and_play_list_hbox.pack_start(self.screen_frame, True, True)
self.screen_and_play_list_hbox.pack_start(self.play_list, False, False)
#
self.main_vbox.pack_start(self.screen_and_play_list_hbox, True, True)
#
self.app.main_box.pack_start(self.main_ali, True, True)
def show_play_list(self):
self.screen_and_play_list_hbox.pack_start(self.play_list, False, False)
def hide_play_list(self):
self.screen_and_play_list_hbox.remove(self.play_list)
示例3: Application
# 需要導入模塊: from dtk.ui.application import Application [as 別名]
# 或者: from dtk.ui.application.Application import set_icon [as 別名]
)
from dtk.ui.application import Application
from dtk.ui.dragable_tab import TabBox
from dtk.ui.constant import DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT
import gtk
if __name__ == "__main__":
# 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)
示例4: Application
# 需要導入模塊: from dtk.ui.application import Application [as 別名]
# 或者: from dtk.ui.application.Application import set_icon [as 別名]
from dtk.ui.application import Application
from dtk.ui.browser_client import BrowserClient
from dtk.ui.constant import DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT
from dtk.ui.frame import HorizontalFrame
from dtk.ui.theme import ui_theme
if __name__ == "__main__":
# Init application.
application = Application("browser_demo")
# Set application default size.
application.set_default_size(DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT)
# Set application icon.
application.set_icon(ui_theme.get_pixbuf("icon.ico"))
# Add titlebar.
application.add_titlebar(
["theme", "menu", "max", "min", "close"],
ui_theme.get_pixbuf("title.png"),
"深度圖形庫",
"/home/andy/deepin-ui/browser_demo.py")
# Add browser.
horizontal_frame = HorizontalFrame()
browser_client = BrowserClient(
"http://ting.baidu.com",
"/home/andy/cookie.txt",
application.app_bus_name,
application.app_dbus_name,
示例5: GameCenterApp
# 需要導入模塊: from dtk.ui.application import Application [as 別名]
# 或者: from dtk.ui.application.Application import set_icon [as 別名]
class GameCenterApp(dbus.service.Object):
def __init__(self, session_bus):
dbus.service.Object.__init__(self, session_bus, GAME_CENTER_DBUS_PATH)
self.conf_db = get_config_file("conf.db")
self.in_wizard_showing = False
self.init_ui()
def init_ui(self):
self.application = Application()
self.application.set_default_size(1000, 660)
self.application.set_skin_preview(get_common_image("frame.png"))
self.application.set_icon(get_common_image("logo48.png"))
self.application.add_titlebar(
["theme", "menu", "max","min", "close"],
show_title=False
)
self.application.window.set_title(_("Deepin Games"))
# Init page box.
self.page_box = gtk.VBox()
self.page_box.connect('expose-event', self.page_box_render)
# Init page align.
self.page_align = gtk.Alignment()
self.page_align.set(0.5, 0.5, 1, 1)
self.page_align.set_padding(0, 0, 2, 2)
# Append page to switcher.
self.paned_box = PanedBox(24)
self.paned_box.add_content_widget(self.page_box)
self.bottom_tip_bar = BottomTipBar()
self.bottom_tip_bar.close_button.connect('clicked', lambda w: self.paned_box.bottom_window.hide())
self.paned_box.add_bottom_widget(self.bottom_tip_bar)
self.page_align.add(self.paned_box)
self.application.main_box.pack_start(self.page_align, True, True)
# Init status bar.
self.statusbar = Statusbar(30)
status_box = gtk.HBox()
self.statusbar.status_box.pack_start(status_box, True, True)
self.application.main_box.pack_start(self.statusbar, False, False)
self.webview = WebView(COOKIE_FILE)
webkit.set_web_database_directory_path(CACHE_DIR)
web_settings = self.webview.get_settings()
web_settings.set_property("enable-page-cache", True)
web_settings.set_property("enable-offline-web-application-cache", True)
#web_settings.set_property("enable-file-access-from-file-uris", True)
web_settings.set_property("enable-xss-auditor", False)
web_settings.set_property('enable-universal-access-from-file-uris', True)
web_settings.set_property("enable-default-context-menu", False)
self.webview.set_settings(web_settings)
#self.webview.enable_inspector()
self.webview.connect('new-window-policy-decision-requested', self.navigation_policy_decision_requested_cb)
#self.webview.connect('notify::load-status', self.webview_load_status_handler)
self.webview.connect('notify::title', self.webview_title_changed_handler)
self.webview.connect('script-alert', self.webview_script_alert_handler)
self.webview.connect('window-object-cleared', self.webview_window_object_cleared)
#self.webview.connect('load-progress-changed', self.load_progress)
self.home_url = urllib.basejoin(GAME_CENTER_SERVER_ADDRESS, 'game/?hl=%s' % LANGUAGE)
self.network_failed_box = NetworkConnectFailed(self.check_network_connection)
self.check_network_connection()
#self.page_box.add(self.network_failed_box)
self.navigatebar = Navigatebar(
[
(None, _("Home"), self.show_home_page),
(None, _("Topics"), self.show_subject_page),
(None, _("My Games"), self.show_mygame_page),
],
font_size = 11,
padding_x = 5,
padding_y = 16,
vertical=False,
item_normal_pixbuf=DynamicPixbuf(get_common_image('top/nav_normal.png')),
item_hover_pixbuf=DynamicPixbuf(get_common_image('top/nav_hover.png')),
item_press_pixbuf=DynamicPixbuf(get_common_image('top/nav_press.png')),
)
self.navigatebar.set_size_request(-1, 56)
self.navigatebar_align = gtk.Alignment(0, 0, 1, 1)
self.navigatebar_align.set_padding(0, 0, 4, 0)
self.navigatebar_align.add(self.navigatebar)
self.application.titlebar.set_size_request(-1, 56)
self.application.titlebar.left_box.pack_start(self.navigatebar_align, True, True)
self.application.window.add_move_event(self.navigatebar)
self.about_dialog = AboutDialog(_('About us'))
self.about_dialog.set_transient_for(self.application.window)
# Init menu.
#if LANGUAGE == 'en_US':
#menu_min_width = 185
#else:
#menu_min_width = 150
#.........這裏部分代碼省略.........
示例6: AssemblyIDE
# 需要導入模塊: from dtk.ui.application import Application [as 別名]
# 或者: from dtk.ui.application.Application import set_icon [as 別名]
class AssemblyIDE(object):
def __init__ (self):
self.app = Application()
# Set app size.
self.app.set_default_size(APP_WIDTH, APP_HEIGHT)
self.app.set_icon(app_theme.get_pixbuf("logo.ico"))
self.app.set_skin_preview(app_theme.get_pixbuf("frame.png"))
# Add app titlebar.
self.app.add_titlebar(["theme", "max", "min", "close"],
app_theme.get_pixbuf("logo.png"),
"Assembly-IDE v 1.0", " ", add_separator = True)
self.vbox_ali = gtk.Alignment()
self.vbox_ali.set(1, 1, 1, 1)
self.vbox_ali.set_padding(6, 2, 2, 2)
self.vbox = gtk.VBox()
self.vbox_ali.add(self.vbox)
self.init_root_menu()
self.init_top_toolbar()
self.code_edit = CodeEdit()
self.code_edit_file = self.code_edit.file_path
self.complie_show_list = ComplieShowList()
self.code_edit.connect("codeedit-changed-file-name", self.modify_code_edit_file_name)
self.vbox.pack_start(self.top_toolbar_ali, False, False)
self.vbox.pack_start(self.code_edit, True,True)
self.vbox.pack_start(self.complie_show_list, False, False)
self.app.main_box.pack_start(self.vbox_ali, True, True)
self.app.window.show_all()
def init_root_menu(self):
# Init file menu.
file_menu = Menu(
[(None, "新建", lambda : self.code_edit.clear()), # 清空代碼編輯器.
(None, "打開", lambda : self.open_file_dialog_window()),
(None),
(None, "我的程序...", None),
(None),
(None, "保存", lambda : self.code_edit.save()),
(None, "另存為", None),
(None),
(None, "退出", lambda :gtk.main_quit())
]
)
# Init edit menu.
edit_menu = Menu(
[(None, "剪切", None),
(None, "複製", None),
(None, "粘帖", None),
(None, "全選", None),
(None),
(None, "注釋", lambda : self.notes_line()),
(None, "取消注釋", lambda : self.notes_line()),
(None),
(None, "撤銷", None),
(None, "恢複", None),
(None),
(None, "查找", None),
(None, "替換", None),
(None, "定位到行", None)
]
)
# Init run menu.
run_menu = Menu(
[(None, "編譯成目標文件", None),
(None, "生成可執行文件", None),
(None, "生成動態鏈接庫文件", None),
(None, "運行", None),
(None, "多模塊鏈接", None),
(None, "調試", None),
(None, "運行LINUX控製台程序", None)
]
)
# Init tool menu.
tool_menu = Menu(
[(None, "選項", None),
(None, "計算器", lambda :open_gcalctool())
]
)
# Init help menu.
help_menu = Menu(
[(None, "幫助主題", None),
(None, "關於", None),
]
)
# Init root menu.
self.root_menu = Menu(
[(None, "文件", file_menu),
(None, "編輯", edit_menu),
(None, "運行", run_menu),
(None, "工具", tool_menu),
(None, "幫助", help_menu),
],
True
)
#.........這裏部分代碼省略.........
示例7: Application
# 需要導入模塊: from dtk.ui.application import Application [as 別名]
# 或者: from dtk.ui.application.Application import set_icon [as 別名]
# Init application.
application = Application(resizable=False)
application.window.connect("focus-out-event", application_focus_changed_cb, "o")
application.window.connect("focus-in-event", application_focus_changed_cb, "i")
# Set application default size.
application.window.set_geometry_hints(
None,
WINDOW_WIDTH, WINDOW_HEIGHT,
WINDOW_WIDTH, WINDOW_HEIGHT,
)
image_dir = os.path.join(get_parent_dir(__file__, 2), "image")
# Set application icon.
application.set_icon(os.path.join(image_dir, "icon.png"))
# Set application preview pixbuf.
application.set_skin_preview(os.path.join(image_dir, "frame.png"))
# Add titlebar.
application.add_titlebar(
["min", "close"],
os.path.join(image_dir, "logo.png"),
_("System Settings"),
enable_gaussian=False,
name_size=10,
)
frame_padding = 2
frame_padding_top = 0
示例8: __init__
# 需要導入模塊: from dtk.ui.application import Application [as 別名]
# 或者: from dtk.ui.application.Application import set_icon [as 別名]
def __init__(self):
gobject.GObject.__init__(self)
image_dir = os.path.join(get_parent_dir(__file__, 3), "image")
application = Application("DMuisc", resizable=False)
application.close_callback = self.prompt_quit
application.set_icon(os.path.join(image_dir, "logo.ico"))
application.set_skin_preview(os.path.join(image_dir, "frame.png"))
application.add_titlebar(
["theme", "menu", "min", "close"],
os.path.join(image_dir, "logo1.png"),
_("DMusic")
)
application.titlebar.menu_button.connect("button-press-event", self.menu_button_press)
application.titlebar.connect("button-press-event", self.right_click_cb)
# Window mode change.
self.revert_toggle_button = self.create_revert_button()
self.revert_toggle_button.connect("toggled", self.change_view)
application.titlebar.button_box.pack_start(self.revert_toggle_button)
application.titlebar.button_box.reorder_child(self.revert_toggle_button, 1)
self.window = application.window
self.window.is_disable_window_maximized = self.is_disable_window_maximized
utils.set_main_window(self)
self.plugins = plugins.PluginsManager(self, False)
self.browser_manager = BrowserMananger()
self.tray_icon = TrayIcon(self)
self.lyrics_display = LyricsModule()
self.list_manager = ListManager()
self.simple_header_bar = SimpleHeadbar()
self.preference_dialog = PreferenceDialog()
self.equalizer_win = EqualizerWindow()
self.mmkeys = MMKeys()
self.audiocd = AudioCDSource()
self.playlist_ui = playlist_ui
self.mini_window = MiniWindow()
self.window.add_move_event(self.simple_header_bar)
bottom_box = gtk.HBox()
self.browser_align = gtk.Alignment()
self.browser_align.set_padding(0, 0, 0, 0)
self.browser_align.set(0.5, 0.5, 1, 1)
list_manager_align = gtk.Alignment()
list_manager_align.set_padding(0, 0, 0, 0)
list_manager_align.set(1, 1, 1, 1)
list_manager_align.add(self.list_manager)
self.browser_align.add(self.browser_manager)
bottom_box.pack_start(list_manager_align, False, False)
bottom_box.pack_start(self.browser_align, True, True)
self.browser_align.set_no_show_all(True)
main_box = gtk.VBox()
self.header_box = gtk.VBox()
self.header_box.add(self.simple_header_bar)
main_box.pack_start(self.header_box, False)
main_box.pack_start(bottom_box, True)
self.link_box = gtk.HBox()
self.link_box.pack_start(create_right_align(), True, True)
self.link_box.pack_start(LinkButton(_("Join us"), "http://www.linuxdeepin.com/joinus/job"), False, False)
status_box = gtk.HBox(spacing=5)
status_box.pack_start(jobs_manager)
status_box.pack_start(self.link_box, padding=5)
status_bar = gtk.EventBox()
status_bar.set_visible_window(False)
status_bar.set_size_request(-1, 22)
status_bar.add(status_box)
application.main_box.pack_start(main_box)
application.main_box.pack_start(status_bar, False, True)
# if config.get("globalkey", "enable", "false") == "true":
# global_hotkeys.start_bind()
if config.get("setting", "window_mode") == "simple":
self.revert_toggle_button.set_active(False)
else:
self.revert_toggle_button.set_active(True)
self.change_view(self.revert_toggle_button)
if config.get("window", "x") == "-1":
self.window.set_position(gtk.WIN_POS_CENTER)
else:
self.window.move(int(config.get("window","x")),int(config.get("window","y")))
# try:
# self.window.resize(int(config.get("window","width")),int(config.get("window","height")))
# except:
# pass
# window_state = config.get("window", "state")
# if window_state == "maximized":
#.........這裏部分代碼省略.........
示例9: GUI
# 需要導入模塊: from dtk.ui.application import Application [as 別名]
# 或者: from dtk.ui.application.Application import set_icon [as 別名]
class GUI(object):
"""Media Player GUI kernel code.核心界麵代碼"""
def __init__(self):
"""application."""
self.__init_values()
self.app = Application(False)
# application set.
app_w, app_h = 800, 570 # 初始化寬,高.
min_app_w, min_app_h = 480, 300 # 防止超過,界麵布局被破壞.
self.app.set_default_size(min_app_w, min_app_h)
self.app.window.set_default_size(app_w, app_h)
# self.app.window.resize
image_dir = os.path.join(get_parent_dir(__file__, 2), "image")
self.app.set_icon(os.path.join(image_dir, "icon.ico"))
self.app.set_skin_preview(os.path.join(os.path.join(image_dir, "frame.png")))
# set titlebar.
self.app.add_titlebar(["theme", "menu", "max", "min", "close"],
os.path.join(os.path.join(image_dir, "logo.png")),
_("DPlayer"), " ",
add_separator=False)
#
self.play_menus = PlayMenus()
# 設置主題菜單.
self.app.set_menu_callback(lambda button: self.play_menus.show_theme_menu(button))
#
self.main_ali = gtk.Alignment()
self.main_vbox = gtk.VBox()
self.main_ali.add(self.main_vbox)
self.main_ali.set(0, 0, 1.0, 1.0)
self.main_ali.set_padding(0, 2, 2, 2)
#
self.mid_combo_event = gtk.EventBox()
self.mid_combo_event.connect("expose-event", self.mid_combo_event_expose_event)
self.screen_mid_combo = ScreenMidCombo()
self.mid_combo_event.set_visible_window(True)
self.mid_combo_event.add(self.screen_mid_combo)
# movie screen. 電影播放屏幕.
# 播放屏幕和播放列表的HBOX.
self.play_list_view = PlayListView()
self.screen_paned = Paned()
self.screen_paned.paint_bottom_window = self.__paint_bottom_toolbar_background
self.screen_frame = gtk.Alignment(0.0, 0.0, 1.0, 1.0)
self.screen = gtk.DrawingArea()
self.screen_frame.add(self.screen)
self.top_toolbar = ToolBar()
self.bottom_toolbar = BottomToolBar()
# BUG: 當顯示上部工具條的時候,畫麵抖動.
self.screen_paned.add_top_widget(self.top_toolbar.hbox_hframe)
self.screen_paned.add_bottom_widget(self.bottom_toolbar.vbox)
#self.screen_paned.add_mid_widget(self.screen_mid_combo)
self.screen_paned.add_mid_widget(self.mid_combo_event)
#
self.screen_frame_event = self.screen_paned
self.screen_paned.screen = self.screen
#
self.screen_paned.add1(self.screen_frame)
self.screen_paned.add2(self.play_list_view.play_list_vbox)
#
self.play_control_panel = BottomToolBar(False)
#
self.main_vbox.pack_start(self.screen_paned, True, True)
self.main_vbox.pack_start(self.play_control_panel.vbox, False, False)
#
self.app.main_box.pack_start(self.main_ali, True, True)
def __init_values(self):
self.child2_show_check = False # True 顯示 False 隱藏
################################################################################
##
def __paint_bottom_toolbar_background(self, e):
# 將皮膚的圖片畫在bottom toolbar上,作為背景.
cr = e.window.cairo_create()
bottom_size = e.window.get_size()
# draw background.
cr.set_source_rgba(*alpha_color_hex_to_cairo(("#ebebeb", 0.1)))
cr.rectangle(0, 0, bottom_size[0], bottom_size[1])
cr.fill()
# draw background pixbuf.
pixbuf = skin_config.background_pixbuf
app_h = self.app.window.allocation.height
app_w = self.app.window.allocation.width
bottom_h = bottom_size[1]
# 當圖片的高度小雨窗口高度的時候,隻拿出圖片的最尾巴.
if pixbuf.get_height() > app_h + bottom_h:
h = app_h
else:
h = pixbuf.get_height() - bottom_h
# 當圖片小於窗口寬度的時候,拉伸圖片.
if pixbuf.get_width() < app_w:
pixbuf = pixbuf.scale_simple(app_w,
pixbuf.get_width(),
gtk.gdk.INTERP_BILINEAR)
draw_pixbuf(cr,
pixbuf,
0,
-h)
#.........這裏部分代碼省略.........
示例10: UpdateManager
# 需要導入模塊: from dtk.ui.application import Application [as 別名]
# 或者: from dtk.ui.application.Application import set_icon [as 別名]
class UpdateManager(dbus.service.Object):
def __init__(self, session_bus):
dbus.service.Object.__init__(self, session_bus, DSC_UPDATE_MANAGER_PATH)
self.in_update_list = False
self.in_upgrade_packages = False
self.upgrade_pkg_infos = []
self.application = Application()
self.application.set_default_size(400, 250)
self.application.add_titlebar(
button_mask=['min', 'close'],
app_name='Software Update Manager',
)
self.application.window.set_title("Software Update Manager")
self.application.set_icon(get_common_image('update.png'))
# Init page box.
self.page_box = gtk.VBox()
# Init page align.
self.page_align = gtk.Alignment()
self.page_align.set(0.5, 0.5, 1, 1)
self.page_align.set_padding(0, 0, 2, 2)
self.page_align.add(self.page_box)
self.application.main_box.pack_start(self.page_align, True, True)
# Init status bar.
self.statusbar = Statusbar(28)
status_box = gtk.HBox()
self.statusbar.status_box.pack_start(status_box, True, True)
self.application.main_box.pack_start(self.statusbar, False, False)
self.background = BackgroundBox()
self.background.draw_mask = self.draw_mask
self.page_box.pack_start(self.background)
self.upgrade_button = Button('更新軟件')
self.upgrade_button.set_sensitive(False)
button_box = gtk.HBox()
button_box.pack_start(self.upgrade_button, False, False)
button_box_align = gtk.Alignment(0.5, 0.5, 0, 0)
button_box_align.set_padding(3, 8, 4, 4)
button_box_align.add(button_box)
self.statusbar.status_item_box.pack_start(button_box_align)
self.update_info_label = Label("初始化...")
self.update_info_label_align = create_align((0.5, 0.5, 0, 0))
self.update_info_label_align.add(self.update_info_label)
self.upgrade_button.connect('clicked', self.upgrade_packages)
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
#.........這裏部分代碼省略.........
示例11: DeepinSoftwareCenter
# 需要導入模塊: from dtk.ui.application import Application [as 別名]
# 或者: from dtk.ui.application.Application import set_icon [as 別名]
class DeepinSoftwareCenter(dbus.service.Object, Logger):
'''
class docs
'''
pages = ['home', 'upgrade', 'uninstall', 'install']
def __init__(self, session_bus, arguments):
'''
init docs
'''
dbus.service.Object.__init__(self, session_bus, DSC_FRONTEND_PATH)
Logger.__init__(self)
self.simulate = "--simulate" in arguments
global debug_flag
debug_flag = "--debug" in arguments
self.in_wizard_showing = False
self.init_hide = False
def exit(self):
gtk.main_quit()
def open_download_directory(self):
run_command("xdg-open %s" % get_software_download_dir())
def switch_page(self, page):
switch_page(self.page_switcher, self.page_box, page, self.detail_page)
def show_home_page(self):
if self.detail_page and self.home_page:
self.switch_page(self.home_page)
def show_upgrade_page(self):
if self.detail_page and self.upgrade_page:
self.switch_page(self.upgrade_page)
def show_uninstall_page(self):
if self.detail_page and self.uninstall_page:
self.switch_page(self.uninstall_page)
def show_install_page(self):
if self.detail_page and self.install_page:
self.switch_page(self.install_page)
@dbus.service.method(DSC_FRONTEND_NAME, in_signature="s", out_signature="")
def show_page(self, key):
try:
index = self.pages.index(key)
if index != self.navigatebar.get_index():
method = "show_%s_page" % key
getattr(self, method)()
self.navigatebar.set_index(index)
except:
print "Unknow page:", key
def init_ui(self):
self.loginfo("Init ui")
# Init application.
self.application = Application(
resizable=False,
destroy_func=self.application_close_window,
)
self.application.set_default_size(888, 634)
self.application.set_skin_preview(utils.get_common_image("frame.png"))
self.application.set_icon(utils.get_common_image("logo48.png"))
self.application.add_titlebar(
["theme", "menu", "min", "close"],
show_title=False
)
self.application.window.set_title(_("Deepin Store"))
self.application.window.connect("delete-event", self.application_close_window)
# Init page box.
self.page_box = gtk.VBox()
# Init page switcher.
self.page_switcher = HSlider(200)
self.page_switcher.append_page(self.page_box)
self.page_switcher.set_to_page(self.page_box)
# Init page align.
self.page_align = gtk.Alignment()
self.page_align.set(0.5, 0.5, 1, 1)
self.page_align.set_padding(0, 0, 2, 2)
# Append page to switcher.
self.paned_box = PanedBox(24)
self.paned_box.add_content_widget(self.page_switcher)
self.bottom_tip_bar = BottomTipBar()
self.bottom_tip_bar.close_button.connect('clicked', lambda w: self.paned_box.bottom_window.hide())
self.paned_box.add_bottom_widget(self.bottom_tip_bar)
self.page_align.add(self.paned_box)
self.application.main_box.pack_start(self.page_align, True, True)
# Init status bar.
self.statusbar = Statusbar(24)
status_box = gtk.HBox()
self.message_box = gtk.HBox()
#.........這裏部分代碼省略.........