本文整理汇总了Python中dtk.ui.application.Application类的典型用法代码示例。如果您正苦于以下问题:Python Application类的具体用法?Python Application怎么用?Python Application使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Application类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
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()
示例2: __init__
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)
示例3: __init__
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)
示例4: __init__
def __init__(self,
app_support_colormap=True,
resizable=True,
window_type=gtk.WINDOW_TOPLEVEL,
destroy_func=None,
always_at_center=True,
max_callback=None,
):
'''
Initialize the Application class.
@param app_support_colormap: Set False if your program don't allow manipulate colormap,
such as mplayer, otherwise you should keep this option as True.
@param resizable: Set this option with False if you want window's size fixed, default is True.
'''
# Init.
Application.__init__(
self,
app_support_colormap,
resizable,
window_type,
destroy_func,
always_at_center
)
''' Initialize
self.app_support_colormap = app_support_colormap
self.resizable = resizable
self.window_type = window_type
self.close_callback = self.close_window
self.skin_preview_pixbuf = None
self.destroy_func = destroy_func
self.always_at_center = always_at_center
self.init()
'''
if max_callback:
self.max_callback = max_callback
else:
self.max_callback = lambda w:self.window.toggle_max_window()
self.skin_preview_pixbuf = None
示例5: __init__
def __init__(self):
'''application.'''
self.__init_values()
self.app = Application(False)
# application set.
app_w, app_h = 890, 590
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
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.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)
'''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_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)
示例6: WorkListApp
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()
示例7: UpdateManager
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
#.........这里部分代码省略.........
示例8: init_theme
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from dtk.ui.init_skin import init_theme
init_theme()
from dtk.ui.application import Application
application = Application()
application.set_default_size(600, 450)
application.add_titlebar(title="Hello world!")
application.run()
示例9: return
align.set(0.5, 0.5, 0.0, 0.0)
align.add(gtk.Button(name))
return (name, align)
if __name__ == "__main__":
# Build DBus name.
app_dbus_name = "com.deepin.demo"
app_object_name = "/com/deepin/demo"
# Check unique.
if is_exists(app_dbus_name, app_object_name):
sys.exit()
# Init application.
application = Application()
# Startup unique service, must after application code.
app_bus_name = dbus.service.BusName(app_dbus_name, bus=dbus.SessionBus())
UniqueService(app_bus_name, app_dbus_name, app_object_name, application.raise_to_top)
# Set application default size.
application.set_default_size(DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT)
# Set application icon.
application.set_icon(app_theme.get_pixbuf("icon.ico"))
# Set application preview pixbuf.
application.set_skin_preview(app_theme.get_pixbuf("frame.png"))
# Add titlebar.
示例10: AssemblyIDE
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
)
#.........这里部分代码省略.........
示例11: init_ui
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()
self.message_label = Label("", enable_gaussian=True)
label_align = gtk.Alignment()
label_align.set(0.0, 0.5, 0, 0)
label_align.set_padding(0, 0, 10, 0)
label_align.add(self.message_label)
self.message_box.pack_start(label_align)
join_us_button = LinkButton(_("Join us"), "http://www.linuxdeepin.com/joinus/job")
join_us_button_align = gtk.Alignment()
join_us_button_align.set(0.5, 0.5, 0, 0)
join_us_button_align.set_padding(0, 3, 0, 10)
join_us_button_align.add(join_us_button)
status_box.pack_start(self.message_box, True, True)
status_box.pack_start(join_us_button_align, False, False)
self.statusbar.status_box.pack_start(status_box, True, True)
self.application.main_box.pack_start(self.statusbar, False, False)
# Init navigatebar.
self.detail_page = None
self.home_page = None
self.upgrade_page = None
self.uninstall_page = None
self.install_page = None
self.navigatebar = Navigatebar(
[
(DynamicPixbuf(utils.get_common_image("navigatebar/nav_home.png")), _("Home"), self.show_home_page),
(DynamicPixbuf(utils.get_common_image("navigatebar/nav_update.png")), _("Upgrade"), self.show_upgrade_page),
(DynamicPixbuf(utils.get_common_image("navigatebar/nav_uninstall.png")), _("Uninstall"), self.show_uninstall_page),
(DynamicPixbuf(utils.get_common_image("navigatebar/nav_download.png")), _("Installation"), self.show_install_page),
],
font_size = 11,
padding_x = 2,
padding_y = 2,
vertical=False,
item_hover_pixbuf=DynamicPixbuf(utils.get_common_image("navigatebar/nav_hover.png")),
item_press_pixbuf=DynamicPixbuf(utils.get_common_image("navigatebar/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)
# Init menu.
if LANGUAGE == 'en_US':
menu_min_width = 185
else:
menu_min_width = 150
menu = Menu(
[
(None, _("Refresh package lists"), lambda:global_event.emit('start-update-list')),
(None, _("Open download directory"), self.open_download_directory),
(None, _("Clear up cached packages"), self.clean_download_cache),
#.........这里部分代码省略.........
示例12: 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
menu = Menu(
[
(None, _("Clear all cached data"), self.clean_download_cache),
(None, _("See what's new"), lambda : self.show_wizard_win()),
(None, _("About us"), self.show_about_dialog),
(None, _("Quit"), lambda: gtk.main_quit()),
],
is_root_menu=True,
#menu_min_width=menu_min_width,
#.........这里部分代码省略.........
示例13: init_theme
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from dtk.ui.init_skin import init_theme
init_theme()
from dtk.ui.application import Application
from dtk.ui.button import ToggleButton
from dtk.ui.theme import ui_theme
from dtk.ui.dialog import ConfirmDialog
import gtk
if __name__ == "__main__":
application = Application()
application.set_default_size(600, 450)
application.add_titlebar(title="ToggleButton example!")
toggle_button = ToggleButton(
inactive_normal_dpixbuf=ui_theme.get_pixbuf("switchbutton/off.png"),
active_normal_dpixbuf=ui_theme.get_pixbuf("switchbutton/on.png"),
button_label="This is toggle button",
padding_x=5,
)
toggle_button.connect(
"toggled",
lambda w: ConfirmDialog(
"反馈对话框",
"按钮开启" if w.get_active() else "按钮关闭",
).show_all())
toggle_button_align = gtk.Alignment()
toggle_button_align.set(0.5, 0.5, 0, 0)
示例14: Application
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
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.
示例15: show_video
from dtk.ui.frame import HorizontalFrame, VerticalFrame
from dtk.ui.mplayer_view import MplayerView
from dtk.ui.statusbar import Statusbar
'''
FIXME: ImportError: No module named dragbar
dragbar木有了?
'''
from dtk.ui.dragbar import Dragbar
def show_video(widget, xid):
'''Show video.'''
run_command("mplayer -fs -wid %s %s" % (xid, "/data/Video/Manatee.avi"))
if __name__ == "__main__":
# Init application.
application = Application("demo", False)
# 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"),
"电影播放器",
"深度Linux视频演示")
# Add mplayer view.