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


Python Application.add_titlebar方法代码示例

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


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

示例1: WorkListApp

# 需要导入模块: from dtk.ui.application import Application [as 别名]
# 或者: from dtk.ui.application.Application import add_titlebar [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: GUI

# 需要导入模块: from dtk.ui.application import Application [as 别名]
# 或者: from dtk.ui.application.Application import add_titlebar [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)        
开发者ID:hailongqiu,项目名称:movie_down,代码行数:44,代码来源:gui.py

示例3: Application

# 需要导入模块: from dtk.ui.application import Application [as 别名]
# 或者: from dtk.ui.application.Application import add_titlebar [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(app_theme.get_pixbuf("icon.ico"))
    
    # Set application preview pixbuf.
    application.set_skin_preview(app_theme.get_pixbuf("frame.png"))
    
    # Add titlebar.
    application.add_titlebar(
        ["theme", "max", "min", "close"], 
        app_theme.get_pixbuf("logo.png"), 
        "TreeView demo",
        "TreeView demo",
        )
    
    # Add TreeView.
    treeview = TreeView(get_dir_items(os.path.expanduser("~")))
    # treeview = TreeView(get_dir_items("/"))
    treeview_align = gtk.Alignment()
    treeview_align.set(0.5, 0.5, 1, 1)
    treeview_align.set_padding(0, 2, 2, 2)
    
    treeview.set_column_titles(["文件名", "大小", "类型", "修改时间"],
                               [sort_by_name, sort_by_size, sort_by_type, sort_by_mtime])
    
    treeview_align.add(treeview)
    application.main_box.pack_start(treeview_align)
开发者ID:liuhuan520,项目名称:deepin-ui,代码行数:34,代码来源:treeview_demo.py

示例4: run_command

# 需要导入模块: from dtk.ui.application import Application [as 别名]
# 或者: from dtk.ui.application.Application import add_titlebar [as 别名]
    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.
    mplayer_view = MplayerView()
    mplayer_view.connect("get-xid", show_video)
    mplayer_frame = HorizontalFrame()
    mplayer_frame.add(mplayer_view)
    
    main_box = gtk.VBox()
    main_box.pack_start(mplayer_frame)
    
    main_frame = VerticalFrame()
    main_frame.add(main_box)
    application.main_box.pack_start(main_frame)
开发者ID:Jiarui315,项目名称:deepin-ui,代码行数:33,代码来源:mplayer_demo.py

示例5: Application

# 需要导入模块: from dtk.ui.application import Application [as 别名]
# 或者: from dtk.ui.application.Application import add_titlebar [as 别名]
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 preview pixbuf.
    application.set_skin_preview(os.path.join(get_current_dir(__file__), "frame.png"))
    
    # Add titlebar.
    application.add_titlebar(
        ["theme", "max", "min", "close"], 
        )
    
    # Add TreeView.
    treeview = TreeView()
    treeview.add_items(map(TextItem, ["Node1", "Node2", "Node3"]))
    treeview.visible_items[0].add_items(map(TextItem, ["Node1 - SubNode1", "Node1 - SubNode2", "Node1 - SubNode3"]))
    treeview.visible_items[1].add_items(map(TextItem, ["Node2 - SubNode1", "Node2 - SubNode2", "Node2 - SubNode3"]))
    treeview.visible_items[2].add_items(map(TextItem, ["Node3 - SubNode1", "Node3 - SubNode2", "Node3 - SubNode3"]))
    
    treeview_align = gtk.Alignment()
    treeview_align.set(0.5, 0.5, 1, 1)
    treeview_align.set_padding(0, 2, 2, 2)
    treeview_align.add(treeview)
    
    application.main_box.pack_start(treeview_align)
开发者ID:Jiarui315,项目名称:deepin-ui,代码行数:33,代码来源:skin_demo.py

示例6: Application

# 需要导入模块: from dtk.ui.application import Application [as 别名]
# 或者: from dtk.ui.application.Application import add_titlebar [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(app_theme.get_pixbuf("icon.ico"))
    
    # Set application preview pixbuf.
    application.set_skin_preview(app_theme.get_pixbuf("frame.png"))
    
    # Add titlebar.
    application.add_titlebar(
        ["theme", "max", "min", "close"], 
        app_theme.get_pixbuf("logo.png"), 
        "LunarCalendar demo",
        "LunarCalendar demo",
        )
    
    # Add Scalebar.
    deepin_lunar_obj = deepin_lunar.new()
    align = gtk.Alignment()
    align.set(0.5, 0.5, 1, 1)
    align.set_padding(0, 2, 2, 2)
    align.add(deepin_lunar_obj)
    
    application.main_box.pack_start(align)

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

示例7: init_theme

# 需要导入模块: from dtk.ui.application import Application [as 别名]
# 或者: from dtk.ui.application.Application import add_titlebar [as 别名]
#! /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)
开发者ID:Biobeyoung,项目名称:linuxdeepin-application-development-manual,代码行数:33,代码来源:toggle_button.py

示例8: init_skin

# 需要导入模块: from dtk.ui.application import Application [as 别名]
# 或者: from dtk.ui.application.Application import add_titlebar [as 别名]
app_theme = init_skin(
        "deepin-ui",
        "1.0",
        "default",
        os.path.join(get_parent_dir(__file__, 2), "skin"),
        os.path.join(get_current_dir(__file__), "app_theme"),
        )
from dtk.ui.application import Application
from dtk.ui.button import ImageButton
from dtk.ui.dialog import ConfirmDialog
import gtk

if __name__ == "__main__":
    application = Application()
    application.set_default_size(600, 450)
    application.add_titlebar(title="ImageButton example!")
    
    image_button = ImageButton(
        normal_dpixbuf=app_theme.get_pixbuf("action/play_normal.png"),
        hover_dpixbuf=app_theme.get_pixbuf("action/play_hover.png"),
        press_dpixbuf=app_theme.get_pixbuf("action/play_press.png"),
        insensitive_dpixbuf=None,
        scale_x=False,
        content=None,
        )
    image_button.connect(
        "clicked", 
        lambda w: ConfirmDialog(
            title="反馈对忽框",
            message="点击播放按钮",
            ).show_all())
开发者ID:Biobeyoung,项目名称:linuxdeepin-application-development-manual,代码行数:33,代码来源:image_button.py

示例9: FootBox

# 需要导入模块: from dtk.ui.application import Application [as 别名]
# 或者: from dtk.ui.application.Application import add_titlebar [as 别名]
        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

    main_align = gtk.Alignment()
    main_align.set(0.5, 0.5, 1, 1)
    main_align.set_padding(frame_padding_top, frame_padding, frame_padding, frame_padding)
    main_box = gtk.VBox()
    body_box = gtk.VBox()
    foot_box = FootBox()

    # Init module infos.
开发者ID:electricface,项目名称:deepin-system-settings,代码行数:33,代码来源:main.py

示例10: __init__

# 需要导入模块: from dtk.ui.application import Application [as 别名]
# 或者: from dtk.ui.application.Application import add_titlebar [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":
#.........这里部分代码省略.........
开发者ID:itfan,项目名称:deepin-music-player,代码行数:103,代码来源:instance.py

示例11: init_theme

# 需要导入模块: from dtk.ui.application import Application [as 别名]
# 或者: from dtk.ui.application.Application import add_titlebar [as 别名]
#! /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()
开发者ID:Biobeyoung,项目名称:linuxdeepin-application-development-manual,代码行数:13,代码来源:hello.py

示例12: GUI

# 需要导入模块: from dtk.ui.application import Application [as 别名]
# 或者: from dtk.ui.application.Application import add_titlebar [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)

#.........这里部分代码省略.........
开发者ID:nohappiness,项目名称:deepin-media-player,代码行数:103,代码来源:gui.py

示例13: UniqueService

# 需要导入模块: from dtk.ui.application import Application [as 别名]
# 或者: from dtk.ui.application.Application import add_titlebar [as 别名]
 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(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", "menu", "max", "min", "close"], 
     os.path.join(get_current_dir(__file__), "logo.png"), 
     "深度图形库",
     "/home/andy/deepin-ui/loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooony.py",
     )
 
 # Draw application background.
 button = gtk.Button()
 button.set_size_request(200,300)
 
 # Init menu callback.
 sub_menu_a = Menu(
     [(None, "子菜单A1", None),
      None,
      (None, "子菜单A2", None),
      (None, "子菜单A3", None),
      ])
 sub_menu_e = Menu(
开发者ID:Jiarui315,项目名称:deepin-ui,代码行数:34,代码来源:demo.py

示例14: UpdateManager

# 需要导入模块: from dtk.ui.application import Application [as 别名]
# 或者: from dtk.ui.application.Application import add_titlebar [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
#.........这里部分代码省略.........
开发者ID:iceleaf916,项目名称:software-update-manager,代码行数:103,代码来源:main.py

示例15: Application

# 需要导入模块: from dtk.ui.application import Application [as 别名]
# 或者: from dtk.ui.application.Application import add_titlebar [as 别名]
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,
        )
    horizontal_frame.add(browser_client)
    application.main_box.pack_start(horizontal_frame)
    
    # Run.
开发者ID:Jiarui315,项目名称:deepin-ui,代码行数:33,代码来源:browser_demo.py


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