當前位置: 首頁>>代碼示例>>Python>>正文


Python KListView.scrollBy方法代碼示例

本文整理匯總了Python中kdeui.KListView.scrollBy方法的典型用法代碼示例。如果您正苦於以下問題:Python KListView.scrollBy方法的具體用法?Python KListView.scrollBy怎麽用?Python KListView.scrollBy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在kdeui.KListView的用法示例。


在下文中一共展示了KListView.scrollBy方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: MainWindow

# 需要導入模塊: from kdeui import KListView [as 別名]
# 或者: from kdeui.KListView import scrollBy [as 別名]

#.........這裏部分代碼省略.........
                        # we're using titles, so we have to get it
                        title = self.game_titles[name]
                        item = self.listView.findItem(title, 0)
                        # here True means select, False means unselect
                        self.listView.setSelected(item, True)
                        # calling setSelected will emit the selection changed signal
                        # which will result in this method being called again, although
                        # internally this time.
                    self._make_listitem_visible(item)
                    
        
            else:
                # we only change the textView for internal calls
                self.textView.set_game_info(name)
                
    # here we make the selected item visible on the list
    # if it's not currently visible
    def _make_listitem_visible(self, item):
        item_pos = item.itemPos()
        # contentsY is the position in the contents that
        # is at the top of the visible area
        contentsY = self.listView.contentsY()
        # contentsHeight is the height of the full list
        contentsHeight = self.listView.contentsHeight()
        # visibleHeight is the height of the visible part of the list
        visibleHeight = self.listView.visibleHeight()
        # visible_range is the interval defining the contents positions
        # that are visible
        visible_range = range(contentsY, contentsY + visibleHeight)
        # here we test whether the item position is in the range of
        # visible positions, and if not, we scroll the listview to make it so.
        if item_pos not in visible_range:
            self.listView.setContentsPos(0, 0)
            self.listView.scrollBy(0, item_pos)
            
    def slotNewGame(self):
        if self.new_game_dir_dialog is None:
            main_dosbox_path = self.myconfig.get('dosbox', 'main_dosbox_path')
            dlg = KDirSelectDialog(main_dosbox_path, 0, self)
            dlg.connect(dlg, SIGNAL('okClicked()'), self.new_game_path_selected)
            dlg.connect(dlg, SIGNAL('cancelClicked()'), self.destroy_new_game_dir_dlg)
            dlg.connect(dlg, SIGNAL('closeClicked()'), self.destroy_new_game_dir_dlg)
            dlg.show()
            self.new_game_dir_dialog = dlg
        else:
            KMessageBox.error(self, opendlg_errormsg)

    def slotLaunchDosbox(self, game=None):
        self._launchdosbox_common(game, launch_game=True)

    def slotLaunchDosboxPrompt(self, game=None):
        self._launchdosbox_common(game, launch_game=False)

    def slotLaunchMainDosboxPrompt(self):
        KMessageBox.information(self, 'Not implemented')
        
    def slotManageDosboxProfiles(self):
        #from dosboxcfg.profile import ProfileDialogWindow
        #win = ProfileDialogWindow(self)
        win = ManageDosboxProfilesWindow(self)
        win.show()

    def slotSetCurrentProfile(self):
        dlg = ProfileSelectorDialog(self)
        self.connect(dlg, SIGNAL('okClicked()'), self._current_profile_selected)
        self.set_profile_dlg = dlg
開發者ID:BackupTheBerlios,項目名稱:dosbox-pykde-svn,代碼行數:70,代碼來源:mainwindow.py


注:本文中的kdeui.KListView.scrollBy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。