def __updateStoreButtons(self): view = self.__viewHandler.getView() curStore = view.store() if view.doc(): allStores = Connector().lookupDoc(view.doc()).stores() else: allStores = Connector().lookupRev(view.rev()) # update store buttons in status bar for store in set(self.__storeButtons) ^ set(allStores): if store in allStores: button = DocButton(store, store, checkable=True) button.clicked.connect(lambda x,store=store: self.__switchStore(store)) self.statusBar().addPermanentWidget(button) self.__storeButtons[store] = button else: self.statusBar().removeWidget(self.__storeButtons[store]) del self.__storeButtons[store] for (store,button) in self.__storeButtons.items(): button.setChecked(store == curStore)
def __init__(self, store, stores, descr, parent=None): super(DocumentTab, self).__init__(parent) if store in stores: self.__store = store else: self.__store = stores[0] self.__buttons = {} mainLayout = QtGui.QVBoxLayout() mainLayout.addWidget(QtGui.QLabel("The " + descr + " exists on the following stores:")) subLayout = QtGui.QHBoxLayout() for store in stores: button = DocButton(store, store, True, True) button.setCheckable(True) button.setChecked(store == self.__store) button.clicked.connect(lambda x, store=store: self.__switchStore(store)) subLayout.addWidget(button) self.__buttons[store] = button subLayout.addStretch() mainLayout.addLayout(subLayout) self.setLayout(mainLayout)
def __updateStoreButtons(self): view = self.__viewHandler.getView() curStore = view.store() if view.doc(): allStores = Connector().lookupDoc(view.doc()).stores() else: allStores = Connector().lookupRev(view.rev()) # update store buttons in status bar for store in set(self.__storeButtons) ^ set(allStores): if store in allStores: button = DocButton(store, store, checkable=True) button.clicked.connect( lambda x, store=store: self.__switchStore(store)) self.statusBar().addPermanentWidget(button) self.__storeButtons[store] = button else: self.statusBar().removeWidget(self.__storeButtons[store]) del self.__storeButtons[store] for (store, button) in self.__storeButtons.items(): button.setChecked(store == curStore)
def __init__(self, store, stores, descr, parent=None): super(DocumentTab, self).__init__(parent) if store in stores: self.__store = store else: self.__store = stores[0] self.__buttons = {} mainLayout = QtGui.QVBoxLayout() mainLayout.addWidget( QtGui.QLabel("The " + descr + " exists on the following stores:")) subLayout = QtGui.QHBoxLayout() for store in stores: button = DocButton(store, store, True, True) button.setCheckable(True) button.setChecked(store == self.__store) button.clicked.connect( lambda x, store=store: self.__switchStore(store)) subLayout.addWidget(button) self.__buttons[store] = button subLayout.addStretch() mainLayout.addLayout(subLayout) self.setLayout(mainLayout)