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


Python MediaList.display_length方法代码示例

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


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

示例1: MenuShow

# 需要导入模块: from pp_medialist import MediaList [as 别名]
# 或者: from pp_medialist.MediaList import display_length [as 别名]

#.........这里部分代码省略.........
        self.show_params["medialist_obj"] = self.medialist

        # load the menu track
        self.start_load_show_loop(self.medialist.track(index))

    # *********************
    # Playing show or track loop
    # *********************

    def start_load_show_loop(self, selected_track):
        # shuffle players
        Show.base_shuffle(self)
        self.mon.trace(self, "")
        self.display_eggtimer()

        # get control bindings for this show
        # needs to be done for each track as track can override the show controls
        if self.show_params["disable-controls"] == "yes":
            self.controls_list = []
        else:
            reason, message, self.controls_list = self.controlsmanager.get_controls(self.show_params["controls"])
            if reason == "error":
                self.mon.err(self, message)
                self.end("error", "error in controls")
                return

        # load the track or show
        Show.base_load_track_or_show(self, selected_track, self.what_next_after_load, self.end_shower, False)

    # track has loaded (menu or otherwise) so show it.
    def what_next_after_load(self, status, message):
        # get the calculated length of the menu for the loaded menu track
        if self.current_player.__class__.__name__ == "MenuPlayer":
            if self.medialist.display_length() == 0:
                self.req_next = "error"
                self.what_next_after_showing()
                return
            self.medialist.start()
            self.menu_index = 0
            self.menu_length = self.current_player.menu_length
            self.current_player.highlight_menu_entry(self.menu_index, True)
        self.mon.trace(self, " - load complete with status: " + status + "  message: " + message)
        if self.current_player.play_state == "load-failed":
            self.req_next = "error"
            self.what_next_after_showing()

        else:
            if (
                self.show_timeout_signal is True
                or self.terminate_signal is True
                or self.exit_signal is True
                or self.user_stop_signal is True
            ):
                self.what_next_after_showing()
            else:
                self.mon.trace(self, "")
                self.current_player.show(self.track_ready_callback, self.finished_showing, self.closed_after_showing)

    def finished_showing(self, reason, message):
        # showing has finished with 'pause at end', showing the next track will close it after next has started showing
        self.mon.trace(self, "")
        self.mon.log(self, "pause at end of showing track with reason: " + reason + " and message: " + message)
        self.sr.hide_click_areas(self.controls_list)
        if self.current_player.play_state == "show-failed":
            self.req_next = "error"
        else:
开发者ID:JosHel,项目名称:pipresents-gapless,代码行数:70,代码来源:pp_menushow.py

示例2: __init__

# 需要导入模块: from pp_medialist import MediaList [as 别名]
# 或者: from pp_medialist.MediaList import display_length [as 别名]

#.........这里部分代码省略.........
        print 'total height', total_height
        print 'y separation', self.y_separation

        
    # ------------------------------------------------------------------
    #calculate menu entry size and separation between menu entries
    # ------------------------------------------------------------------
    def calculate_geometry(self):

        self.display_strip=self.show_params['menu-strip']
        self.screen_width=int(self.canvas['width'])
        self.screen_height=int(self.canvas['height'])
        
        if self.display_strip=='yes':
            self.strip_padding=int(self.show_params['menu-strip-padding'])
        else:
            self.strip_padding=0

        # parse the menu window
        error,reason,self.menu_x_left,self.menu_y_top,self.menu_x_right,self.menu_y_bottom=self.parse_menu_window(self.show_params['menu-window'])
        if error<>'normal':
            return 'error',"Menu Window error: "+ reason

        if self.show_params['menu-icon-mode']=='none' and self.show_params['menu-text-mode']=='none':
            return 'error','Icon and Text are both None'
        if self.show_params['menu-icon-mode']=='none' and self.show_params['menu-text-mode']=='overlay':
            return 'error','cannot overlay none icon'

        self.direction=self.show_params['menu-direction']
        
        self.menu_width=self.menu_x_right - self.menu_x_left
        self.menu_height=self.menu_y_bottom - self.menu_y_top

        self.list_length=self.medialist.display_length()

        # get or calculate rows and columns
        if self.direction=='horizontal':
            if self.show_params['menu-columns']=='':
                return 'error','blank columns for horizontal direction'
            self.menu_columns=int(self.show_params['menu-columns'])
            self.menu_rows=self.list_length//self.menu_columns
            if self.list_length % self.menu_columns<>0:
                self.menu_rows+=1
        else:
            if self.show_params['menu-rows']=='':
                return 'error','blank rows for vertical direction'
            self.menu_rows=int(self.show_params['menu-rows'])
            self.menu_columns=self.list_length//self.menu_rows
            if self.list_length % self.menu_rows<>0:
                self.menu_columns+=1
                
        self.x_separation=int(self.show_params['menu-horizontal-separation'])
        self.y_separation=int(self.show_params['menu-vertical-separation'])

        # get size of padding depending on exitence of icon and text
        if self.show_params['menu-icon-mode'] in ('thumbnail','bullet') and self.show_params['menu-text-mode'] == 'right':
            self.menu_horizontal_padding=int(self.show_params['menu-horizontal-padding'])
        else:
            self.menu_horizontal_padding=0

        if self.show_params['menu-icon-mode'] in ('thumbnail','bullet') and self.show_params['menu-text-mode'] == 'below':
            self.menu_vertical_padding=int(self.show_params['menu-vertical-padding'])
        else:
            self.menu_vertical_padding=0
            
        #calculate size of icon depending on use
开发者ID:KenT2,项目名称:pipresents-next,代码行数:70,代码来源:pp_menushow.py


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