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


Python Window.present方法代码示例

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


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

示例1: SimplyUbuntuApplication

# 需要导入模块: from window import Window [as 别名]
# 或者: from window.Window import present [as 别名]
class SimplyUbuntuApplication(Gtk.Application):
    def __init__(self):
        Gtk.Application.__init__(self)

    def do_startup(self):
        Gtk.Application.do_startup(self)

    def do_activate(self):
        self._win = Window(self)
        self._win.present()
开发者ID:eslammostafa,项目名称:simply-ubuntu,代码行数:12,代码来源:application.py

示例2: Application

# 需要导入模块: from window import Window [as 别名]
# 或者: from window.Window import present [as 别名]
class Application(Gtk.Application):
    def __init__(self):
        Gtk.Application.__init__(self,
                                 application_id='org.gnome.Music',
                                 flags=Gio.ApplicationFlags.FLAGS_NONE,
                                 inactivity_timeout=12000)
        GLib.set_application_name("Music")

    def do_startup(self):
        Gtk.Application.startup(self)

    def do_activate(self):
        if self._window:
            self._window = Window(self)
        self._window.present()

    def Quit(self):
        self.quit()
开发者ID:sumansai14,项目名称:gnome-music-python,代码行数:20,代码来源:application.py

示例3: do_activate

# 需要导入模块: from window import Window [as 别名]
# 或者: from window.Window import present [as 别名]
 def do_activate(self):
     win = Window(self)
     win.present()
开发者ID:eslammostafa,项目名称:bankam,代码行数:5,代码来源:application.py

示例4: UserManual

# 需要导入模块: from window import Window [as 别名]
# 或者: from window.Window import present [as 别名]

#.........这里部分代码省略.........
    def emit_group_button_press(self, button_group, book, chapter_index, page_id):
        buttons = button_group.buttons
        active_button = buttons[chapter_index]
        if button_group.current_active != active_button:
            button_group.current_active = active_button
        for button in buttons:
            button.selected = (button == active_button)
        book_contents = get_book_contents(book)
        self.push_data_to_web_view(
                self.index_html_str,
                book_contents, # Values[0]
                book, # Values[1]
                chapter_index, # Values[2]
                page_id, # Values[3]
                self.home_values[book]["unread_pages"][chapter_index]) # Values[4]

    def get_chapter_button_group(self, book, book_contents, active_index):
        chapters = book_contents["content"]
        chapter_buttons = []
        for i in range(len(chapters)):
            chapter_buttons.append(SelectButton(i, chapters[i].get("title")))
        chapter_buttons_group = SelectButtonGroup(chapter_buttons)
        chapter_buttons[int(active_index)].selected = True
        chapter_buttons_group.connect("button-press", self.chapter_button_press, book, book_contents)
        return chapter_buttons_group

    def push_data_to_web_view(self, html_string, *data):
        self.load_data = []
        for d in data:
            self.load_data.append(d)
        self.web_view.load(html_string, self.html_base_url)

    def chapter_button_press(self, group, active_button, book, book_contents):
        chapter_index = active_button.chapter_index
        page_id = self.home_values[book]["all_pages"][chapter_index][0]
        self.push_data_to_web_view(
                self.index_html_str, 
                book_contents, # Values[0]
                book, # Values[1]
                chapter_index, # Values[2]
                page_id, # Values[3]
                self.home_values[book]["unread_pages"][chapter_index]) # Values[4]

    def page_go_back(self, widget, event):
        self.fresh_read_percent()
        self.push_data_to_web_view(self.home_html_str, self.home_values_to_list())
        title_align_child = self.title_align.get_child()
        if title_align_child:
            self.title_align.remove(title_align_child)
        self.title_align.add(home_title_bar)
        back.set_state(gtk.STATE_NORMAL)
        self.window.show_all()

    def load_committed_cb(self, view, frame):
        self.web_view.execute_script("var Values=%s" % json.dumps(self.load_data, encoding="UTF-8", ensure_ascii=False))

    def load_finished_cb(self, view, frame):
        if len(self.load_data) > 1:
            book = self.load_data[1]
            chapter_index = self.load_data[2]
            page_id = self.load_data[3]
            self.remove_read_page(book, chapter_index, page_id)
            self.web_view.execute_script("load_page();")
            if chapter_index == 0:
                self.web_view.execute_script('change_nav_status("Left", "none")')
                self.web_view.execute_script('$("#msg").css("display", "none")')

    def init_progress_data(self):
        for book in self.home_values:
            all_pages = get_book_pages_id(book)
            self.home_values[book]["all_pages"] = all_pages
            unread_pages = get_book_unread_pages(self.home_values[book]["book"])
            self.home_values[book]["unread_pages"] = unread_pages
        self.fresh_read_percent()

    def fresh_read_percent(self):
        for key in self.home_values:
            unread_pages = self.home_values[key]["unread_pages"]
            all_pages = self.home_values[key]["all_pages"]
            unread_length = 0
            all_length = 0
            for i in range(len(all_pages)):
                unread_length += len(unread_pages[i])
                all_length += len(all_pages[i])
            percent = 1 - float(unread_length)/all_length
            self.home_values[key]["percent"] = "%.2f" % percent

    def remove_read_page(self, book, chapter_index, page_id):
        if page_id in self.home_values[book]["unread_pages"][chapter_index]:
            self.home_values[book]["unread_pages"][chapter_index].remove(page_id)
        
    def home_values_to_list(self):
        data = []
        for key in self.home_values:
            data.append(self.home_values[key])
        return data

    @dbus.service.method(DEEPIN_USER_MANUAL_NAME, in_signature="", out_signature="")    
    def hello(self):
        self.window.present()
开发者ID:electricface,项目名称:deepin-user-manual,代码行数:104,代码来源:main.py


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