def __init__(self, pageParam, parent=None): super().__init__('0', parent=parent) self.imagesAtBottom = pageParam.images_at_bottom self._model = None self.param = pageParam self.id = pageParam.id self.treeView = TreeView(pageParam.treeParam, self) if self.param.type == CollectionPageTypes.Card: self.listView = CardView(self.param.listParam, self) elif self.param.type == CollectionPageTypes.Icon: self.listView = IconView(self.param.listParam, self) else: self.listView = ListView(self.param.listParam, self) if self.imagesAtBottom: self.imageView = ImageView(QBoxLayout.LeftToRight, self) self.detailsView = DetailsView(QBoxLayout.TopToBottom, self) else: self.imageView = ImageView(QBoxLayout.TopToBottom, self) self.detailsView = DetailsView(QBoxLayout.LeftToRight, self) self.splitter1 = Splitter('1', Qt.Vertical, self) splitter2 = Splitter('2', parent=self.splitter1) splitter2.addWidget(self.treeView) splitter2.addWidget(self.listView) self.splitter1.addWidget(splitter2) if self.imagesAtBottom: self.splitter1.addWidget(self.imageView) else: self.splitter1.addWidget(self.detailsView) if statisticsAvailable: self.statisticsView = StatisticsView(pageParam.statisticsParam) self.statisticsView.setMinimumHeight(200) if importedQtWebKit: settings = Settings() if settings['map_type'] == 0 or not gmapsAvailable: self.mapView = GlobalOSMWidget() else: self.mapView = GlobalGMapsWidget() self.mapView.markerClicked.connect(self.setCurrentCoin) self.addWidget(self.splitter1) if self.imagesAtBottom: self.addWidget(self.detailsView) else: self.addWidget(self.imageView) self.listView.rowChanged.connect(self.imageView.rowChangedEvent) self.listView.rowChanged.connect(self.treeView.rowChangedEvent) self.listView.rowChanged.connect(self.detailsView.rowChangedEvent) self.splitterMoved.connect(self.splitterPosChanged)
def __init__(self, pageParam, parent=None): super().__init__('0', parent=parent) imagesAtBottom = pageParam.images_at_bottom self._model = None self.param = pageParam self.id = pageParam.id self.treeView = TreeView(pageParam.treeParam, self) self.listView = ListView(pageParam.listParam, self) if imagesAtBottom: self.imageView = ImageView(QBoxLayout.LeftToRight, self) self.detailsView = DetailsView(QBoxLayout.TopToBottom, self) else: self.imageView = ImageView(QBoxLayout.TopToBottom, self) self.detailsView = DetailsView(QBoxLayout.LeftToRight, self) self.splitter1 = Splitter('1', Qt.Vertical, self) splitter2 = Splitter('2', parent=self.splitter1) splitter2.addWidget(self.treeView) splitter2.addWidget(self.listView) self.splitter1.addWidget(splitter2) if imagesAtBottom: self.splitter1.addWidget(self.imageView) else: self.splitter1.addWidget(self.detailsView) self.statisticsShowed = pageParam.statisticsParam['showed'] if statisticsAvailable: self.statisticsView = StatisticsView(pageParam.statisticsParam, self) self.statisticsView.setMinimumHeight(200) if self.statisticsShowed: self.splitter1.insertWidget(2, self.statisticsView) else: self.splitter1.insertWidget(1, self.statisticsView) self.addWidget(self.splitter1) if imagesAtBottom: self.addWidget(self.detailsView) else: self.addWidget(self.imageView) self.listView.rowChanged.connect(self.imageView.rowChangedEvent) self.listView.rowChanged.connect(self.treeView.rowChangedEvent) self.listView.rowChanged.connect(self.detailsView.rowChangedEvent) self.splitterMoved.connect(self.splitterPosChanged)
class PageView(Splitter): def __init__(self, pageParam, parent=None): super().__init__('0', parent=parent) imagesAtBottom = pageParam.images_at_bottom self._model = None self.param = pageParam self.id = pageParam.id self.treeView = TreeView(pageParam.treeParam, self) if self.param.type == CollectionPageTypes.Card: self.listView = CardView(self.param.listParam, self) elif self.param.type == CollectionPageTypes.Icon: self.listView = IconView(self.param.listParam, self) else: self.listView = ListView(self.param.listParam, self) if imagesAtBottom: self.imageView = ImageView(QBoxLayout.LeftToRight, self) self.detailsView = DetailsView(QBoxLayout.TopToBottom, self) else: self.imageView = ImageView(QBoxLayout.TopToBottom, self) self.detailsView = DetailsView(QBoxLayout.LeftToRight, self) self.splitter1 = Splitter('1', Qt.Vertical, self) splitter2 = Splitter('2', parent=self.splitter1) splitter2.addWidget(self.treeView) splitter2.addWidget(self.listView) self.splitter1.addWidget(splitter2) if imagesAtBottom: self.splitter1.addWidget(self.imageView) else: self.splitter1.addWidget(self.detailsView) if statisticsAvailable: self.statisticsView = StatisticsView(pageParam.statisticsParam) self.statisticsView.setMinimumHeight(200) if importedQtWebKit: settings = Settings() if settings['map_type'] == 0: self.mapView = GlobalOSMWidget() else: self.mapView = GlobalGMapsWidget() self.addWidget(self.splitter1) if imagesAtBottom: self.addWidget(self.detailsView) else: self.addWidget(self.imageView) self.listView.rowChanged.connect(self.imageView.rowChangedEvent) self.listView.rowChanged.connect(self.treeView.rowChangedEvent) self.listView.rowChanged.connect(self.detailsView.rowChangedEvent) self.splitterMoved.connect(self.splitterPosChanged) def setModel(self, model, reference): self._model = model self.treeView.setModel(model, reference) self.listView.setModel(model) self.imageView.setModel(model) self.detailsView.setModel(model) if statisticsAvailable: self.statisticsView.setModel(model) if importedQtWebKit: self.mapView.setModel(model) if statisticsAvailable or importedQtWebKit: self.prepareInfo() self._model.modelChanged.connect(self.modelChanged) def model(self): return self._model def modelChanged(self): self.treeView.modelChanged() self.listView.modelChanged() if self.param.info_type == CollectionPageTypes.Statistics: self.statisticsView.modelChanged() elif self.param.info_type == CollectionPageTypes.Map: self.mapView.modelChanged() def prepareInfo(self): sizes = self.splitter1.sizes() if self.param.info_type == CollectionPageTypes.Map: self.splitter1.switchWidget(1, self.mapView) elif self.param.info_type == CollectionPageTypes.Statistics: self.splitter1.switchWidget(1, self.statisticsView) else: self.splitter1.switchWidget(1, self.detailsView) if sizes[1] > 0: self.splitter1.setSizes(sizes) def showInfo(self, info_type): self.param.info_type = info_type self.prepareInfo() if self.param.info_type == CollectionPageTypes.Statistics: self.statisticsView.modelChanged() elif self.param.info_type == CollectionPageTypes.Map: self.mapView.modelChanged() def changeView(self, type_): index = self.listView.currentIndex() self.listView.rowChanged.disconnect(self.imageView.rowChangedEvent) self.listView.rowChanged.disconnect(self.treeView.rowChangedEvent) self.listView.rowChanged.disconnect(self.detailsView.rowChangedEvent) self.param.type = type_ if self.param.type == CollectionPageTypes.Card: listView = CardView(self.param.listParam, self) self._model.setFilter('') elif self.param.type == CollectionPageTypes.Icon: listView = IconView(self.param.listParam, self) self._model.setFilter('') else: listView = ListView(self.param.listParam, self) splitter2 = self.splitter1.widget(0) splitter2.replaceWidget(1, listView) self.listView = listView self.listView.rowChanged.connect(self.imageView.rowChangedEvent) self.listView.rowChanged.connect(self.treeView.rowChangedEvent) self.listView.rowChanged.connect(self.detailsView.rowChangedEvent) self.listView.setModel(self._model) self.listView.modelChanged() if index.isValid(): self.listView.setFocus() self.listView.scrollToIndex(index)
class PageView(Splitter): def __init__(self, pageParam, parent=None): super().__init__('0', parent=parent) imagesAtBottom = pageParam.images_at_bottom self._model = None self.param = pageParam self.id = pageParam.id self.treeView = TreeView(pageParam.treeParam, self) self.listView = ListView(pageParam.listParam, self) if imagesAtBottom: self.imageView = ImageView(QBoxLayout.LeftToRight, self) self.detailsView = DetailsView(QBoxLayout.TopToBottom, self) else: self.imageView = ImageView(QBoxLayout.TopToBottom, self) self.detailsView = DetailsView(QBoxLayout.LeftToRight, self) self.splitter1 = Splitter('1', Qt.Vertical, self) splitter2 = Splitter('2', parent=self.splitter1) splitter2.addWidget(self.treeView) splitter2.addWidget(self.listView) self.splitter1.addWidget(splitter2) if imagesAtBottom: self.splitter1.addWidget(self.imageView) else: self.splitter1.addWidget(self.detailsView) self.statisticsShowed = pageParam.statisticsParam['showed'] if statisticsAvailable: self.statisticsView = StatisticsView(pageParam.statisticsParam, self) self.statisticsView.setMinimumHeight(200) if self.statisticsShowed: self.splitter1.insertWidget(2, self.statisticsView) else: self.splitter1.insertWidget(1, self.statisticsView) self.addWidget(self.splitter1) if imagesAtBottom: self.addWidget(self.detailsView) else: self.addWidget(self.imageView) self.listView.rowChanged.connect(self.imageView.rowChangedEvent) self.listView.rowChanged.connect(self.treeView.rowChangedEvent) self.listView.rowChanged.connect(self.detailsView.rowChangedEvent) self.splitterMoved.connect(self.splitterPosChanged) def setModel(self, model, reference): self._model = model self.treeView.setModel(model, reference) self.listView.setModel(model) self.imageView.setModel(model) self.detailsView.setModel(model) if statisticsAvailable: self.statisticsView.setModel(model) self.prepareStatistics(self.statisticsShowed) self._model.modelChanged.connect(self.modelChanged) def model(self): return self._model def modelChanged(self): self.treeView.modelChanged() self.listView.modelChanged() if statisticsAvailable and self.statisticsShowed: self.statisticsView.modelChanged() def prepareStatistics(self, show): if not statisticsAvailable: return sizes = self.splitter1.sizes() old_widget = self.splitter1.widget(1) old_widget.hide() new_widget = self.splitter1.widget(2) new_widget.show() self.splitter1.insertWidget(1, new_widget) if self.statisticsShowed != show: self.param.statisticsParam['showed'] = show self.statisticsShowed = show self.splitter1.setSizes(sizes) def showStatistics(self, show): self.prepareStatistics(show) if show: self.statisticsView.modelChanged()