Beispiel #1
0
    def __init__(self, parent=None, rows=[], name='ListBox', columns=[]):
        self.__clist_rows__ = rows
        if len(self.__clist_rows__):
            test_row = self.__clist_rows__[0]
            if not (hasattr(test_row, '_keylist_')
                    or hasattr(test_row, '_desc_')):
                if columns:
                    if len(columns) == 1:
                        nrows = [[x] for x in self.__clist_rows__]
                        self.__clist_rows__ = nrows
                    dbrows = [
                        DbBaseRow(columns, x) for x in self.__clist_rows__
                    ]
                    self.__clist_rows__ = dbrows
                    self.__clist_row_desc = self.__clist_rows__[0]._keylist_
                    self.__col_titles__ = self.__clist_row_desc

                else:
                    self.__clist_row_desc = None
                    self.__col_titles__ = ['nothing']
            else:
                if hasattr(test_row, '_desc_'):
                    self.__clist_row_desc = [x[0] for x in test_row._desc_]
                else:
                    self.__clist_row_desc = test_row._keylist_
                self.__col_titles__ = self.__clist_row_desc
        else:
            self.__col_titles__ = ['nothing']
            self.__clist_rows__ = []
        QListView.__init__(self, None)
        self.__setup_listbox()
        self.show()
        self.append_rows()
Beispiel #2
0
 def __init__(self, parent=None, rows=[], name='ListBox', columns=[]):
     self.__clist_rows__ = rows
     if len(self.__clist_rows__):
         test_row = self.__clist_rows__[0]
         if not (hasattr(test_row, '_keylist_') or hasattr(test_row, '_desc_')):
             if columns:
                 if len(columns) == 1:
                     nrows = [[x] for x in self.__clist_rows__]
                     self.__clist_rows__ = nrows
                 dbrows = [DbBaseRow(columns, x) for x in self.__clist_rows__]
                 self.__clist_rows__ = dbrows
                 self.__clist_row_desc = self.__clist_rows__[0]._keylist_
                 self.__col_titles__ = self.__clist_row_desc
                 
             else:
                 self.__clist_row_desc = None
                 self.__col_titles__ = ['nothing']
         else:
             if hasattr(test_row, '_desc_'):
                 self.__clist_row_desc = [x[0] for x in test_row._desc_]
             else:
                 self.__clist_row_desc = test_row._keylist_
             self.__col_titles__ = self.__clist_row_desc
     else:
         self.__col_titles__ = ['nothing']
         self.__clist_rows__ = []
     QListView.__init__(self, None)
     self.__setup_listbox()
     self.show()
     self.append_rows()
Beispiel #3
0
 def __init__(self, scene):
     QListView.__init__(self)
     self.scene = scene
     decorateWindow(self, m18n("Explain Scores").replace("&", ""))
     self.setGeometry(0, 0, 300, 400)
     self.model = QStringListModel()
     self.setModel(self.model)
     StateSaver(self)
     self.refresh()
Beispiel #4
0
 def __init__(self, scene):
     QListView.__init__(self)
     self.scene = scene
     decorateWindow(self, i18n('Explain Scores').replace('&', ''))
     self.setGeometry(0, 0, 300, 400)
     self.model = QStringListModel()
     self.setModel(self.model)
     StateSaver(self)
     self.refresh()
Beispiel #5
0
 def __init__(self, parent=None):
     QListView.__init__(self, parent)
     self.data = None
     self.col2str = None
     self.setRootIsDecorated(True)
     self.setSorting(-1)
     self.clipBoard = None
     self.accelFilter = None
     self.keyBindingDescriptor = {
         "Ctrl+N": "new",
         "Ctrl+A": "attach",
         "Ctrl+I,Ctrl+L": "insertLeft",
         "Ctrl+I,Ctrl+R": "insertRight",
         "Ctrl+P": "prune",
         "Ctrl+S": "splice"
     }
     self.setKeyBindings(self.keyBindingDescriptor)
 def __init__(self, parent=None):
     QListView.__init__(self, parent)
     self.data = None
     self.col2str = None
     self.setRootIsDecorated(True)
     self.setSorting(-1)
     self.clipBoard = None
     self.accelFilter = None
     self.keyBindingDescriptor = {
         "Ctrl+N": "new",
         "Ctrl+A": "attach",
         "Ctrl+I,Ctrl+L": "insertLeft",
         "Ctrl+I,Ctrl+R": "insertRight",
         "Ctrl+P": "prune",
         "Ctrl+S": "splice",
     }
     self.setKeyBindings(self.keyBindingDescriptor)
Beispiel #7
0
    def __init__(self, parent):
        QMainWindow.__init__(self, parent, 'PyQt Dosbox Frontend')
        # setup app pointer
        self.app = qApp
        self._init_common()

        self.splitView = QSplitter(self, 'splitView')
        self.listView = QListView(self.splitView, 'games_view')
        self.initlistView()
        x, y = self.config.get_xy('mainwindow', 'mainwindow_size')
        self.splitView.setSizes([int(.1*x), int(.9*x)])
        self.connect(self.listView,
                     SIGNAL('selectionChanged()'), self.selectionChanged)
        self.textView = InfoBrowser(self.splitView)
        self.setCentralWidget(self.splitView)
Beispiel #8
0
 def __init__(self, parent=None):
     QSplitter.__init__(self, parent, 'hsplit')
     self.setOrientation(QSplitter.Horizontal)
     self.listbox = QListView(self)
     #self.insertWidget(self.listbox)
     self.notebook = QTabBar(self)
Beispiel #9
0
class MainWindow(MainWindowCommon, QMainWindow):
    def __init__(self, parent):
        QMainWindow.__init__(self, parent, 'PyQt Dosbox Frontend')
        # setup app pointer
        self.app = qApp
        self._init_common()

        self.splitView = QSplitter(self, 'splitView')
        self.listView = QListView(self.splitView, 'games_view')
        self.initlistView()
        x, y = self.config.get_xy('mainwindow', 'mainwindow_size')
        self.splitView.setSizes([int(.1*x), int(.9*x)])
        self.connect(self.listView,
                     SIGNAL('selectionChanged()'), self.selectionChanged)
        self.textView = InfoBrowser(self.splitView)
        self.setCentralWidget(self.splitView)
        
        
        
    def initActions(self):
        self.quitAction = QuitAction(self.close, self)
        self.newGameAction = NewGame(self.slotNewGame, self)
        self.launchDosboxAction = LaunchDosbox(self.slotLaunchDosbox, self)
        self.flatViewAction = FlatView(self.slotFlatView, self)
        self.treeViewAction = TreeView(self.slotTreeView, self)
        self.nameViewAction = NameView(self.slotNameView, self)
        self.titleViewAction = TitleView(self.slotTitleView, self)
        self.prepareAllGamesAction = PrepareAllGames(self.slotPrepareAllGames, self)
        self.cleanAllGamesAction = CleanAllGames(self.slotCleanAllGames, self)
        self.archiveAllGamesAction = ArchiveAllGames(self.slotArchiveAllGames, self)
        self.filterAllGamesAction = FilterAllGames(self.slotFilterAllGames, self)
        self.filterAvailableGamesAction = \
                                        FilterAvailableGames(self.slotFilterAvailableGames,
                                                             self)
        self.filterUnavailableGamesAction = \
                                          FilterUnavailableGames(self.slotFilterUnavailableGames,
                                                                 self)

    def initMenus(self):
        mainmenu = QPopupMenu(self)
        self.newGameAction.addTo(mainmenu)
        self.launchDosboxAction.addTo(mainmenu)
        mainmenu.insertSeparator()
        self.prepareAllGamesAction.addTo(mainmenu)
        self.cleanAllGamesAction.addTo(mainmenu)
        self.archiveAllGamesAction.addTo(mainmenu)
        self.quitAction.addTo(mainmenu)
        optionmenu = QPopupMenu(self)
        self.flatViewAction.addTo(optionmenu)
        self.treeViewAction.addTo(optionmenu)
        self.nameViewAction.addTo(optionmenu)
        self.titleViewAction.addTo(optionmenu)
        optionmenu.insertSeparator()
        self.filterAllGamesAction.addTo(optionmenu)
        self.filterAvailableGamesAction.addTo(optionmenu)
        self.filterUnavailableGamesAction.addTo(optionmenu)
        menubar = self.menuBar()
        menubar.insertItem('&Main', mainmenu)
        menubar.insertItem('&Options', optionmenu)

    # do nothing here, for now
    def initToolbar(self):
        pass
    
    def refreshListView(self):
        self.refreshListView_common(QListViewItem)

    def _appendListItem(self, parent, name):
        self._appendListItem_common(parent, name, QListViewItem)
        
    def selectGame(self, name, called_externally=False):
        self.textView.set_game_info(name)

    def slotLaunchDosbox(self, game=None):
        if game is None:
            game = self.listView.currentItem().game
        if self.app.game_fileshandler.get_game_status(game):
            self.app.dosbox.run_game(game)
        else:
            title = self.game_titles[game]
            box = QMessageBox.information(self, 'UnavailableGame')
            box.setText('%s is unavailable' % title)