def __fillAddChooser(self): self.__addChooser.clear() self.__addItems = [] enum = Connector().enum() rules = self.__rules.rules() stores = [enum.doc(s) for s in enum.allStores() if not enum.isSystem(s) and enum.isMounted(s)] self.__addItems = [(s, p) for s in stores for p in stores if s < p and (s,p) not in rules and (p,s) not in rules ] self.__addBtn.setEnabled(bool(self.__addItems)) for (store, peer) in self.__addItems: title = (struct.readTitle(struct.DocLink(store, store, False), '?') + ' - ' + struct.readTitle(struct.DocLink(peer, peer, False), '?')) self.__addChooser.addItem(title)
def __init__(self, parent=None): super(Launchbox, self).__init__(parent) self.setSizePolicy( QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Minimum ) self.progressWidgets = {} self.progressContainer = QtGui.QWidget() self.progressLayout = QtGui.QVBoxLayout() self.progressLayout.setMargin(0) self.progressContainer.setLayout(self.progressLayout) self.mainLayout = QtGui.QVBoxLayout() self.mainLayout.setSizeConstraint(QtGui.QLayout.SetMinimumSize) enum = Connector().enum() for store in enum.allStores(): if not enum.isSystem(store): self.mainLayout.addWidget(StoreWidget(store)) syncButton = QtGui.QPushButton("Synchronization") syncButton.clicked.connect(lambda: SyncEditor().exec_()) setupLayout = QtGui.QHBoxLayout() setupLayout.addWidget(syncButton) setupLayout.addStretch() hLine = QtGui.QFrame() hLine.setFrameStyle(QtGui.QFrame.HLine | QtGui.QFrame.Raised) self.mainLayout.addWidget(hLine) self.mainLayout.addLayout(setupLayout) hLine = QtGui.QFrame() hLine.setFrameStyle(QtGui.QFrame.HLine | QtGui.QFrame.Raised) self.mainLayout.addWidget(hLine) self.mainLayout.addWidget(self.progressContainer) self.mainLayout.addStretch() self.setLayout(self.mainLayout) self.setWindowTitle("PeerDrive launch box") self.setWindowIcon(QtGui.QIcon("icons/launch.png")) self.setWindowFlags(QtCore.Qt.Window | QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.WindowMinimizeButtonHint) Connector().regProgressHandler(start=self.progressStart, stop=self.progressStop)