def init(self, app, datamanager): super().init(app, datamanager) self.app = app self.effectsViewModel = EffectsTableModel(self.app.settings) self.sortProxyModel = SortProxyModel(self.app.settings) self.sortProxyModel.setSourceModel(self.effectsViewModel) self.widget.effectsView.setModel(self.sortProxyModel) self.tableHeader = self.widget.effectsView.horizontalHeader() self.tableHeader.setSectionsMovable(True) self.tableHeader.setStretchLastSection(True) settings.setHeaderSectionSizes(self.tableHeader, self.app.settings.value('effectswidget/HeaderSectionSizes', [])) settings.setHeaderSectionVisualIndices(self.tableHeader, self.app.settings.value('effectswidget/headerSectionVisualIndices', [])) self.tableHeader.sectionResized.connect(self._slotTableSectionResized) self.tableHeader.sectionMoved.connect(self._slotTableSectionMoved) settings.setSplitterState(self.widget.splitter, self.app.settings.value('effectswidget/splitterState', None)) self.widget.splitter.splitterMoved.connect(self._slotSplitterMoved) self.widget.showPermanentCheckBox.setChecked(bool(int(self.app.settings.value('effectswidget/showPermanent', 0)))) self.widget.showEmptySourcesCheckBox.setChecked(bool(int(self.app.settings.value('effectswidget/showEmptySources', 0)))) self.widget.showInactiveCheckBox.setChecked(bool(int(self.app.settings.value('effectswidget/showInactive', 0)))) self.widget.showPermanentCheckBox.stateChanged.connect(self.effectsViewModel.setShowPermanent) self.widget.showEmptySourcesCheckBox.stateChanged.connect(self.effectsViewModel.setShowEmptySources) self.widget.showInactiveCheckBox.stateChanged.connect(self.effectsViewModel.setShowInactive) if self.sortProxyModel.sortReversed: self.widget.effectsView.sortByColumn(self.sortProxyModel.sortColumn, QtCore.Qt.DescendingOrder) else: self.widget.effectsView.sortByColumn(self.sortProxyModel.sortColumn, QtCore.Qt.AscendingOrder) self.dataManager = datamanager self.dataManager.registerRootObjectListener(self._onPipRootObjectEvent)
def init(self, app, datamanager): super().init(app, datamanager) self.app = app for cat in [ ('All', CatAllModel, SortProxyModel), ('Weapons', CatWeaponsModel, WeaponSortProxyModel), ('Apparel', CatApparelModel, ApparelSortProxyModel), ('Aid', CatAidModel, SortProxyModel), ('Misc', CatMiscModel, SortProxyModel), ('Junk', CatJunkModel, SortProxyModel), ('Mods', CatModsModel, SortProxyModel), ('Ammo', CatAmmoModel, SortProxyModel), ('Books', CatBooksModel, SortProxyModel), ('Holotapes', CatHolotapeModel, SortProxyModel), ('Keys', CatKeysModel, SortProxyModel), ('Components', ComponentsTableModel, SortProxyModel) ]: tab = self._addTab(cat[0], cat[1], cat[2]) self.tabs.append(tab) self.models.append(tab.tableView.model().sourceModel()) self.widget.tabWidget.currentChanged.connect(self._slotCatTabChanged) activeTab = int(self.app.settings.value('inventorybrowser/activeTab', 0)) self.widget.tabWidget.setCurrentIndex(activeTab) settings.setSplitterState(self.widget.splitter1, self.app.settings.value('inventorybrowser/splitter1State', None)) self.widget.splitter1.splitterMoved.connect(self._slotSplitter1Moved) settings.setSplitterState(self.widget.splitter2, self.app.settings.value('inventorybrowser/splitter2State', None)) self.widget.splitter2.splitterMoved.connect(self._slotSplitter2Moved) self.propertyTreeHeader = self.widget.propertyTree.header() settings.setHeaderSectionSizes(self.propertyTreeHeader, self.app.settings.value('inventorybrowser/PropertyHeaderSectionSizes', [])) self.propertyTreeHeader.sectionResized.connect(self._slotPropertyTreeSectionResized) self.widget.filterEdit.textChanged.connect(self._slotFilterTextChanged) self.dataManager = datamanager self.dataManager.registerRootObjectListener(self._onPipRootObjectEvent)
def init(self, app, dataManager): super().init(app, dataManager) self.app = app self.DataManager = dataManager self.selectedWorkshop = None self.workshopModel = WorkshopTableModel(self.Widgets.workshopList) self.sortModel = SortProxyModel(app.settings, 'workshopsbrowser') self.sortModel.setSourceModel(self.workshopModel) self.Widgets.workshopList.setModel(self.sortModel) # we need to call setModel() before selectionModel() (and never afterwards) self.Widgets.workshopList.selectionModel().currentChanged.connect(self.WorkshopListCurrentChanged) self.Widgets.workshopList.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.Widgets.workshopList.customContextMenuRequested.connect(self.workshopListMenuRequested) # Init Splitter settings.setSplitterState(self.Widgets.splitter, self.app.settings.value('workshopsbrowser/splitterState', None)) self.Widgets.splitter.splitterMoved.connect(self._slotSplitterMoved) # Init table header self.tableHeader = self.Widgets.workshopList.horizontalHeader() self.tableHeader.setSectionsMovable(True) self.tableHeader.setStretchLastSection(True) settings.setHeaderSectionSizes(self.tableHeader, self.app.settings.value('workshopsbrowser/HeaderSectionSizes', [])) settings.setHeaderSectionVisualIndices(self.tableHeader, self.app.settings.value('workshopsbrowser/HeaderSectionVisualIndices', [])) if self.sortModel.sortReversed: self.Widgets.workshopList.sortByColumn(self.sortModel.sortColumn, QtCore.Qt.DescendingOrder) else: self.Widgets.workshopList.sortByColumn(self.sortModel.sortColumn, QtCore.Qt.AscendingOrder) self.tableHeader.sectionResized.connect(self._slotTableSectionResized) self.tableHeader.sectionMoved.connect(self._slotTableSectionMoved) self.DataManager.registerRootObjectListener(self.DataManagerUpdated)
def init(self, app, dataManager): super().init(app, dataManager) self._app = app self.DataManager = dataManager self.DataManager.registerRootObjectListener(self._onPipRootObjectEvent) self.AmmoWatchList = self._app.settings.value('ammocount/savedAmmoWatchList', []) if not self.AmmoWatchList: # QSettings are buggy on Linux self.AmmoWatchList = [] settings.setSplitterState(self.widget.splitter, self._app.settings.value('ammocount/splitterState2', None)) self.widget.splitter.splitterMoved.connect(self._slotSplitterMoved) self.setAmmoWatch()
def init(self, app, dataManager): super().init(app, dataManager) self._app = app self.DataManager = dataManager self.DataManager.registerRootObjectListener(self._onPipRootObjectEvent) self.AmmoWatchList = self._app.settings.value( 'ammocount/savedAmmoWatchList', []) if not self.AmmoWatchList: # QSettings are buggy on Linux self.AmmoWatchList = [] settings.setSplitterState( self.widget.splitter, self._app.settings.value('ammocount/splitterState2', None)) self.widget.splitter.splitterMoved.connect(self._slotSplitterMoved) self.setAmmoWatch()
def init(self, app, datamanager): super().init(app, datamanager) self.app = app self.effectsViewModel = EffectsTableModel(self.app.settings) self.sortProxyModel = SortProxyModel(self.app.settings) self.sortProxyModel.setSourceModel(self.effectsViewModel) self.widget.effectsView.setModel(self.sortProxyModel) self.tableHeader = self.widget.effectsView.horizontalHeader() self.tableHeader.setSectionsMovable(True) self.tableHeader.setStretchLastSection(True) settings.setHeaderSectionSizes( self.tableHeader, self.app.settings.value('effectswidget/HeaderSectionSizes', [])) settings.setHeaderSectionVisualIndices( self.tableHeader, self.app.settings.value('effectswidget/headerSectionVisualIndices', [])) self.tableHeader.sectionResized.connect(self._slotTableSectionResized) self.tableHeader.sectionMoved.connect(self._slotTableSectionMoved) settings.setSplitterState( self.widget.splitter, self.app.settings.value('effectswidget/splitterState', None)) self.widget.splitter.splitterMoved.connect(self._slotSplitterMoved) self.widget.showPermanentCheckBox.setChecked( bool(int(self.app.settings.value('effectswidget/showPermanent', 0)))) self.widget.showEmptySourcesCheckBox.setChecked( bool( int( self.app.settings.value('effectswidget/showEmptySources', 0)))) self.widget.showInactiveCheckBox.setChecked( bool(int(self.app.settings.value('effectswidget/showInactive', 0)))) self.widget.showPermanentCheckBox.stateChanged.connect( self.effectsViewModel.setShowPermanent) self.widget.showEmptySourcesCheckBox.stateChanged.connect( self.effectsViewModel.setShowEmptySources) self.widget.showInactiveCheckBox.stateChanged.connect( self.effectsViewModel.setShowInactive) if self.sortProxyModel.sortReversed: self.widget.effectsView.sortByColumn( self.sortProxyModel.sortColumn, QtCore.Qt.DescendingOrder) else: self.widget.effectsView.sortByColumn( self.sortProxyModel.sortColumn, QtCore.Qt.AscendingOrder) self.dataManager = datamanager self.dataManager.registerRootObjectListener(self._onPipRootObjectEvent)
def init(self, app, dataManager): super().init(app, dataManager) self.app = app self.DataManager = dataManager self.selectedWorkshop = None self.workshopModel = WorkshopTableModel(self.Widgets.workshopList) self.sortModel = SortProxyModel(app.settings, 'workshopsbrowser') self.sortModel.setSourceModel(self.workshopModel) self.Widgets.workshopList.setModel( self.sortModel ) # we need to call setModel() before selectionModel() (and never afterwards) self.Widgets.workshopList.selectionModel().currentChanged.connect( self.WorkshopListCurrentChanged) self.Widgets.workshopList.setContextMenuPolicy( QtCore.Qt.CustomContextMenu) self.Widgets.workshopList.customContextMenuRequested.connect( self.workshopListMenuRequested) # Init Splitter settings.setSplitterState( self.Widgets.splitter, self.app.settings.value('workshopsbrowser/splitterState', None)) self.Widgets.splitter.splitterMoved.connect(self._slotSplitterMoved) # Init table header self.tableHeader = self.Widgets.workshopList.horizontalHeader() self.tableHeader.setSectionsMovable(True) self.tableHeader.setStretchLastSection(True) settings.setHeaderSectionSizes( self.tableHeader, self.app.settings.value('workshopsbrowser/HeaderSectionSizes', [])) settings.setHeaderSectionVisualIndices( self.tableHeader, self.app.settings.value( 'workshopsbrowser/HeaderSectionVisualIndices', [])) if self.sortModel.sortReversed: self.Widgets.workshopList.sortByColumn(self.sortModel.sortColumn, QtCore.Qt.DescendingOrder) else: self.Widgets.workshopList.sortByColumn(self.sortModel.sortColumn, QtCore.Qt.AscendingOrder) self.tableHeader.sectionResized.connect(self._slotTableSectionResized) self.tableHeader.sectionMoved.connect(self._slotTableSectionMoved) self.DataManager.registerRootObjectListener(self.DataManagerUpdated)
def init(self, app, datamanager): super().init(app, datamanager) self.app = app for cat in [('All', CatAllModel, SortProxyModel), ('Weapons', CatWeaponsModel, WeaponSortProxyModel), ('Apparel', CatApparelModel, ApparelSortProxyModel), ('Aid', CatAidModel, SortProxyModel), ('Misc', CatMiscModel, SortProxyModel), ('Junk', CatJunkModel, SortProxyModel), ('Mods', CatModsModel, SortProxyModel), ('Ammo', CatAmmoModel, SortProxyModel), ('Books', CatBooksModel, SortProxyModel), ('Holotapes', CatHolotapeModel, SortProxyModel), ('Keys', CatKeysModel, SortProxyModel), ('Components', ComponentsTableModel, SortProxyModel)]: tab = self._addTab(cat[0], cat[1], cat[2]) self.tabs.append(tab) self.models.append(tab.tableView.model().sourceModel()) self.widget.tabWidget.currentChanged.connect(self._slotCatTabChanged) activeTab = int( self.app.settings.value('inventorybrowser/activeTab', 0)) self.widget.tabWidget.setCurrentIndex(activeTab) settings.setSplitterState( self.widget.splitter1, self.app.settings.value('inventorybrowser/splitter1State', None)) self.widget.splitter1.splitterMoved.connect(self._slotSplitter1Moved) settings.setSplitterState( self.widget.splitter2, self.app.settings.value('inventorybrowser/splitter2State', None)) self.widget.splitter2.splitterMoved.connect(self._slotSplitter2Moved) self.propertyTreeHeader = self.widget.propertyTree.header() settings.setHeaderSectionSizes( self.propertyTreeHeader, self.app.settings.value( 'inventorybrowser/PropertyHeaderSectionSizes', [])) self.propertyTreeHeader.sectionResized.connect( self._slotPropertyTreeSectionResized) self.widget.filterEdit.textChanged.connect(self._slotFilterTextChanged) self.dataManager = datamanager self.dataManager.registerRootObjectListener(self._onPipRootObjectEvent)
def init(self, app, datamanager): super().init(app, datamanager) self.app = app self.globalMap = app.iwcGetEndpoint('globalmapwidget') self.pipMapObject = None self.pipMapWorldObject = None self.pipWorldLocations = None self.locationViewModel = LocationTableModel(self.app.settings) self.sortProxyModel = SortProxyModel(self.app.settings) self.sortProxyModel.setSourceModel(self.locationViewModel) self.widget.locationView.setModel(self.sortProxyModel) self.widget.locationView.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.widget.locationView.customContextMenuRequested.connect(self._slotLocationTableContextMenu) self.widget.locationView.selectionModel().currentChanged.connect(self._slotLocationItemSelected) self.widget.locationView.doubleClicked.connect(self._slotLocationItemDoubleClicked) self.locationTableHeader = self.widget.locationView.horizontalHeader() self.locationTableHeader.setSectionsMovable(True) self.locationTableHeader.setStretchLastSection(True) self.propertyTableHeader = self.widget.propertyTable.horizontalHeader() settings.setHeaderSectionSizes(self.locationTableHeader, self.app.settings.value('locationbrowserwidget/LocationHeaderSectionSizes', [])) settings.setHeaderSectionVisualIndices(self.locationTableHeader, self.app.settings.value('locationbrowserwidget/LocationHeaderSectionVisualIndices', [])) if self.sortProxyModel.sortReversed: self.widget.locationView.sortByColumn(self.sortProxyModel.sortColumn, QtCore.Qt.DescendingOrder) else: self.widget.locationView.sortByColumn(self.sortProxyModel.sortColumn, QtCore.Qt.AscendingOrder) self.locationTableHeader.sectionResized.connect(self._slotLocationTableSectionResized) self.locationTableHeader.sectionMoved.connect(self._slotLocationTableSectionMoved) self.propertyTableHeader = self.widget.propertyTable.horizontalHeader() settings.setHeaderSectionSizes(self.propertyTableHeader, self.app.settings.value('locationbrowserwidget/PropertyHeaderSectionSizes', [])) self.propertyTableHeader.sectionResized.connect(self._slotPropertyTableSectionResized) settings.setSplitterState(self.widget.splitter1, self.app.settings.value('locationbrowserwidget/splitter1State', None)) self.widget.splitter1.splitterMoved.connect(self._slotSplitter1Moved) settings.setSplitterState(self.widget.splitter2, self.app.settings.value('locationbrowserwidget/splitter2State', None)) self.widget.splitter2.splitterMoved.connect(self._slotSplitter2Moved) self.widget.showUnknownCheckBox.setChecked(self.sortProxyModel.showUnknown) self.widget.showUnknownCheckBox.stateChanged.connect(self.sortProxyModel.showUnknownLocations) self.widget.filterNameLineEdit.textEdited.connect(self.sortProxyModel.setNameFilterString) self.dataManager = datamanager self.dataManager.registerRootObjectListener(self._onPipRootObjectEvent)
def init(self, app, datamanager): super().init(app, datamanager) self.dataManager = datamanager self.dataManager.registerRootObjectListener(self._onPipRootObjectEvent) self._app = app self.llh = LLHookey() self.widget.btnLoad.clicked.connect(self._loadButtonHandler) self.widget.btnSave.clicked.connect(self._saveButtonHandler) self.widget.btnDelete.clicked.connect(self._deleteButtonHandler) self.widget.btnAdd.clicked.connect(self._addButtonHandler) forcedInstructionsCounter = 1 forceInstructions = int(self._app.settings.value('hotkeyswidget/forcedInstructionsCounter', 0)) < forcedInstructionsCounter if not forceInstructions: settings.setSplitterState(self.widget.splitter, self._app.settings.value('hotkeyswidget/splitterState', None)) self._app.settings.setValue('hotkeyswidget/forcedInstructionsCounter', forcedInstructionsCounter) self.widget.splitter.splitterMoved.connect(self._slotSplitterMoved) Actions['testHotkeyHook'] =Action('Test Hotkey Hook', '', self.testHotkeyHook, 0 ) Actions['toggleAllHotkeys'] =Action('Toggle Hotkeys On/Off', '', self.llh.toggleAllHotkeys, 0 ) Actions['equipNextGrenade'] =Action('Cycle Equipped Grenade', '', self.equipNextGrendae, 0 ) Actions['toggleEquippedGrenades'] =Action('Unequip\Equip Current Grenade', '', self.toggleEquippedGrenades, 0 ) Actions['saveEquippedApparelToSlot'] =Action('Save all currently equipped apparel to slot ', '(param1: Slot Number [1-99])', self.saveEquippedApparelToSlot, 1 ) Actions['equipApparelFromSlot'] =Action('Equip apparel from saved slot', '(param1: Slot Number [1-99])', self.equipApparelFromSlot, 1 ) Actions['unequipAllApparel'] =Action('Unequip all items of apparel', '', self.unequipAllApparel, 0 ) Actions['toggleRadio'] =Action('Toggle Radio On\Off', '', self.toggleRadio, 0 ) Actions['nextRadio'] =Action('Tune to next radio station', '', self.nextRadio, 0 ) Actions['useStimpak'] =Action('Use Stimpak', '', self.useStimpak, 0 ) Actions['useRadaway'] =Action('Use Radaway', '', self.useRadAway, 0 ) Actions['useJet'] = Action('Use Jet', '', self.useJet, 0 ) Actions['useNamedItem'] =Action('Use Named Item' , '(param1: Inventory Section [ie:48], param2: ItemName [ie: psycho])', self.useItemByName, 2 ) Actions['cycleWidgets'] = Action('Cycle Tabbed Widgets', '(param1: Comma seperated list of widget titles to cycle through)', self.cycleWidgets, 1 ) for k, v in VK_CODE.items(): self.widget.keyComboBox.addItem(k, v) for k, v in Actions.items(): self.widget.actionComboBox.addItem(v.name + v.description, k) self.widget.actionComboBox.currentIndexChanged.connect(self._actionComboBoxCurrentIndexChanged) self.widget.param1Label.setVisible(False) self.widget.param1LineEdit.setVisible(False) self.widget.param2Label.setVisible(False) self.widget.param2LineEdit.setVisible(False) self.widget.param3Label.setVisible(False) self.widget.param3LineEdit.setVisible(False) self.widget.btnLoad.setVisible(False) self.loadHotkeys() if(len(self.llh.Hotkeys) == 0): self.llh.addHotkey( Hotkey(keycode=VK_CODE.get('home'), actionkey='testHotkeyHook') ) self.llh.addHotkey( Hotkey(keycode=VK_CODE.get('pause'), shift=True, actionkey='toggleAllHotkeys') ) self.llh.addHotkey( Hotkey(keycode=VK_CODE.get('y'), actionkey='useStimpak')) self.llh.addHotkey( Hotkey(keycode=VK_CODE.get('u'), actionkey='useRadaway')) self.llh.addHotkey( Hotkey(keycode=VK_CODE.get('`'), actionkey='useJet') ) self.llh.addHotkey( Hotkey(keycode=VK_CODE.get('g'), actionkey='equipNextGrenade') ) self.llh.addHotkey( Hotkey(keycode=VK_CODE.get('h'), actionkey='useNamedItem', params=["48", "psycho"]) ) self.llh.addHotkey( Hotkey(keycode=VK_CODE.get('page_up'), actionkey='toggleRadio')) self.llh.addHotkey( Hotkey(keycode=VK_CODE.get('page_down'), actionkey='nextRadio')) self.llh.addHotkey( Hotkey(keycode=VK_CODE.get('numpad_1'), control=True, actionkey='saveEquippedApparelToSlot', params=["1"] )) self.llh.addHotkey( Hotkey(keycode=VK_CODE.get('numpad_1'), control=False, actionkey='equipApparelFromSlot', params=["1"] )) self.llh.addHotkey( Hotkey(keycode=VK_CODE.get('numpad_2'), control=True, actionkey='saveEquippedApparelToSlot', params=["2"] )) self.llh.addHotkey( Hotkey(keycode=VK_CODE.get('numpad_2'), control=False, actionkey='equipApparelFromSlot', params=["2"] )) self.llh.addHotkey( Hotkey(keycode=VK_CODE.get('numpad_3'), control=True, actionkey='saveEquippedApparelToSlot', params=["3"] )) self.llh.addHotkey( Hotkey(keycode=VK_CODE.get('numpad_3'), control=False, actionkey='equipApparelFromSlot', params=["3"] )) self.llh.addHotkey( Hotkey(keycode=VK_CODE.get('numpad_9'), actionkey='unequipAllApparel')) self.llh.addHotkey( Hotkey(keycode=VK_CODE.get('backspace'), actionkey='cycleWidgets', params=["Global Map, HotkeyWidget"])) #self.llh.addHotkey( Hotkey(keycode=VK_CODE.get('home'), control=True , alt=True, shift=True, actionkey='useNamedItem', params=("48", "psycho"))) #h1 = Hotkey(keycode=VK_CODE.get(','), action=self.useItemByName, params=("29", "formal hat")) #h2 = Hotkey(keycode=VK_CODE.get('/'), action=self.llh.removeHotkey, params=(h1)) #h3 = Hotkey(keycode=VK_CODE.get('/'), action=self.llh.disableHotkey, params=(h1)) #self.llh.addHotkey( h1 ) #self.llh.addHotkey( h2 ) #self.llh.addHotkey( h3 ) self.updateTable() self.availableGrenades = [] self.availableRadioStations = [] self.currentRadioStation = None self.lastEquippedGrenade = None self.savedApparelSlots = {} for index in range (0,100): settingPath = 'hotkeyswidget/apparelslots/' self.savedApparelSlots[str(index)] = self._app.settings.value(settingPath+str(index), None) return
def init(self, app, datamanager): super().init(app, datamanager) self._app = app self.mapScene = QtWidgets.QGraphicsScene() self.mapScene.setBackgroundBrush( QtGui.QBrush(QtGui.QColor.fromRgb(0, 0, 0))) self.mapColor = QtGui.QColor.fromRgb(20, 255, 23) # Init graphics view self.COLORTABLE = [] for i in range(256): self.COLORTABLE.append(QtGui.qRgb(i / 4, i, i / 2)) self.mapView = self.widget.graphicsView self.mapView.setScene(self.mapScene) self.mapView.setMouseTracking(True) self.mapView.centerOn(0, 0) self.mapView.viewport().installEventFilter(self) self.dataManager = datamanager # Add map graphics self.mapItem = MapGraphicsItem(self) self.signalSetZoomLevel.connect(self.mapItem.setZoomLevel) self.signalSetColor.connect(self.mapItem.setColor) self.mapEnabledFlag = False # Add player marker self.playerMarker = PlayerMarker(self, self.controller.imageFactory, self.mapColor) self._connectMarker(self.playerMarker) # Init zoom slider self.widget.mapZoomSlider.setMinimum(-100) self.widget.mapZoomSlider.setMaximum(100) self.widget.mapZoomSlider.setValue(0) self.widget.mapZoomSlider.setSingleStep(5) self.widget.mapZoomSlider.valueChanged.connect( self._slotZoomSliderTriggered) # Init zoom Spinbox self.widget.mapZoomSpinbox.setMinimum(self.MAPZOOM_SCALE_MIN * 100.0) self.widget.mapZoomSpinbox.setMaximum(self.MAPZOOM_SCALE_MAX * 100.0) self.widget.mapZoomSpinbox.setValue(100.0) self.widget.mapZoomSpinbox.setSingleStep(10.0) self.widget.mapZoomSpinbox.valueChanged.connect( self._slotZoomSpinTriggered) self.signalSetZoomLevel.connect(self.saveZoom) if self._app.settings.value('localmapwidget/zoom'): self.mapZoomLevel = float( self._app.settings.value('localmapwidget/zoom')) if self.mapZoomLevel == 1.0: sliderValue = 0 elif self.mapZoomLevel > 1.0: sliderValue = (self.mapZoomLevel / self.MAPZOOM_SCALE_MAX) * 100.0 else: sliderValue = -(self.MAPZOOM_SCALE_MIN / self.mapZoomLevel) * 100.0 self.widget.mapZoomSlider.blockSignals(True) self.widget.mapZoomSlider.setValue(sliderValue) self.widget.mapZoomSlider.blockSignals(False) self.widget.mapZoomSpinbox.blockSignals(True) self.widget.mapZoomSpinbox.setValue(self.mapZoomLevel * 100.0) self.widget.mapZoomSpinbox.blockSignals(False) self.signalSetZoomLevel.emit(self.mapZoomLevel, 0, 0) # Init Enable Checkbox self.widget.enableCheckbox.stateChanged.connect( self._slotEnableMapTriggered) self.widget.enableCheckbox.setChecked( bool(int(self._app.settings.value('localmapwidget/enabled', 0)))) # Init SaveTo Button self.widget.saveToButton.clicked.connect(self._slotSaveToTriggered) # Init fps spinner self.mapFPS = int(self._app.settings.value('localmapwidget/fps', 5)) self.widget.fpsSpinBox.setValue(self.mapFPS) self.mapReqTimer.setInterval(int(1000 / self.mapFPS)) self.mapReqTimer.timeout.connect(self._slotSendMapReq) self.widget.fpsSpinBox.valueChanged.connect( self._slotFpsSpinnerTriggered) # Init Splitter settings.setSplitterState( self.widget.splitter, self._app.settings.value('localmapwidget/splitterState', None)) self.widget.splitter.splitterMoved.connect(self._slotSplitterMoved) # Init PyPipboy stuff from .controller import MapCoordinates self.mapCoords = MapCoordinates() self.datamanager = datamanager self.pipMapObject = None self.pipMapWorldObject = None self.pipColor = None self.pipWorldQuests = None self.pipMapQuestsItems = dict() #self._signalPipWorldQuestsUpdated.connect(self._slotPipWorldQuestsUpdated) #self._signalPipWorldLocationsUpdated.connect(self._slotPipWorldLocationsUpdated) self.datamanager.registerRootObjectListener(self._onRootObjectEvent) self.dataManager.registerLocalMapListener(self._onLocalMapUpdate) self._signalMapUpdate.connect(self._slotMapUpdate)
def init(self, app, datamanager): super().init(app, datamanager) self._app = app self.mapScene = QtWidgets.QGraphicsScene() self.mapScene.setBackgroundBrush(QtGui.QBrush(QtGui.QColor.fromRgb(0,0,0))) self.mapColor = QtGui.QColor.fromRgb(20,255,23) # Init graphics view self.COLORTABLE=[] for i in range(256): self.COLORTABLE.append(QtGui.qRgb(i/4,i,i/2)) self.mapView = self.widget.graphicsView self.mapView.setScene(self.mapScene) self.mapView.setMouseTracking(True) self.mapView.centerOn(0, 0) self.mapView.viewport().installEventFilter(self) self.dataManager = datamanager # Add map graphics self.mapItem = MapGraphicsItem(self) self.signalSetZoomLevel.connect(self.mapItem.setZoomLevel) self.signalSetColor.connect(self.mapItem.setColor) self.mapEnabledFlag = False # Add player marker self.playerMarker = PlayerMarker(self,self.controller.imageFactory, self.mapColor) self._connectMarker(self.playerMarker) # Init zoom slider self.widget.mapZoomSlider.setMinimum(-100) self.widget.mapZoomSlider.setMaximum(100) self.widget.mapZoomSlider.setValue(0) self.widget.mapZoomSlider.setSingleStep(5) self.widget.mapZoomSlider.valueChanged.connect(self._slotZoomSliderTriggered) # Init zoom Spinbox self.widget.mapZoomSpinbox.setMinimum(self.MAPZOOM_SCALE_MIN*100.0) self.widget.mapZoomSpinbox.setMaximum(self.MAPZOOM_SCALE_MAX*100.0) self.widget.mapZoomSpinbox.setValue(100.0) self.widget.mapZoomSpinbox.setSingleStep(10.0) self.widget.mapZoomSpinbox.valueChanged.connect(self._slotZoomSpinTriggered) self.signalSetZoomLevel.connect(self.saveZoom) if self._app.settings.value('localmapwidget/zoom'): self.mapZoomLevel = float(self._app.settings.value('localmapwidget/zoom')) if self.mapZoomLevel == 1.0: sliderValue = 0 elif self.mapZoomLevel > 1.0: sliderValue = (self.mapZoomLevel/self.MAPZOOM_SCALE_MAX)*100.0 else: sliderValue = -(self.MAPZOOM_SCALE_MIN/self.mapZoomLevel)*100.0 self.widget.mapZoomSlider.blockSignals(True) self.widget.mapZoomSlider.setValue(sliderValue) self.widget.mapZoomSlider.blockSignals(False) self.widget.mapZoomSpinbox.blockSignals(True) self.widget.mapZoomSpinbox.setValue(self.mapZoomLevel*100.0) self.widget.mapZoomSpinbox.blockSignals(False) self.signalSetZoomLevel.emit(self.mapZoomLevel, 0, 0) # Init Enable Checkbox self.widget.enableCheckbox.stateChanged.connect(self._slotEnableMapTriggered) self.widget.enableCheckbox.setChecked(bool(int(self._app.settings.value('localmapwidget/enabled', 0)))) # Init SaveTo Button self.widget.saveToButton.clicked.connect(self._slotSaveToTriggered) # Init fps spinner self.mapFPS = int(self._app.settings.value('localmapwidget/fps', 5)) self.widget.fpsSpinBox.setValue(self.mapFPS) self.mapReqTimer.setInterval(int(1000/self.mapFPS)) self.mapReqTimer.timeout.connect(self._slotSendMapReq) self.widget.fpsSpinBox.valueChanged.connect(self._slotFpsSpinnerTriggered) # Init Splitter settings.setSplitterState(self.widget.splitter, self._app.settings.value('localmapwidget/splitterState', None)) self.widget.splitter.splitterMoved.connect(self._slotSplitterMoved) # Init PyPipboy stuff from .controller import MapCoordinates self.mapCoords = MapCoordinates() self.datamanager = datamanager self.pipMapObject = None self.pipMapWorldObject = None self.pipColor = None self.pipWorldQuests = None self.pipMapQuestsItems = dict() #self._signalPipWorldQuestsUpdated.connect(self._slotPipWorldQuestsUpdated) #self._signalPipWorldLocationsUpdated.connect(self._slotPipWorldLocationsUpdated) self.datamanager.registerRootObjectListener(self._onRootObjectEvent) self.dataManager.registerLocalMapListener(self._onLocalMapUpdate) self._signalMapUpdate.connect(self._slotMapUpdate)
def init(self, app, datamanager): super().init(app, datamanager) self.app = app self.globalMap = app.iwcGetEndpoint('globalmapwidget') self.pipMapObject = None self.pipMapWorldObject = None self.pipWorldLocations = None self.locationViewModel = LocationTableModel(self.app.settings) self.sortProxyModel = SortProxyModel(self.app.settings) self.sortProxyModel.setSourceModel(self.locationViewModel) self.widget.locationView.setModel(self.sortProxyModel) self.widget.locationView.setContextMenuPolicy( QtCore.Qt.CustomContextMenu) self.widget.locationView.customContextMenuRequested.connect( self._slotLocationTableContextMenu) self.widget.locationView.selectionModel().currentChanged.connect( self._slotLocationItemSelected) self.widget.locationView.doubleClicked.connect( self._slotLocationItemDoubleClicked) self.locationTableHeader = self.widget.locationView.horizontalHeader() self.locationTableHeader.setSectionsMovable(True) self.locationTableHeader.setStretchLastSection(True) self.propertyTableHeader = self.widget.propertyTable.horizontalHeader() settings.setHeaderSectionSizes( self.locationTableHeader, self.app.settings.value( 'locationbrowserwidget/LocationHeaderSectionSizes', [])) settings.setHeaderSectionVisualIndices( self.locationTableHeader, self.app.settings.value( 'locationbrowserwidget/LocationHeaderSectionVisualIndices', [])) if self.sortProxyModel.sortReversed: self.widget.locationView.sortByColumn( self.sortProxyModel.sortColumn, QtCore.Qt.DescendingOrder) else: self.widget.locationView.sortByColumn( self.sortProxyModel.sortColumn, QtCore.Qt.AscendingOrder) self.locationTableHeader.sectionResized.connect( self._slotLocationTableSectionResized) self.locationTableHeader.sectionMoved.connect( self._slotLocationTableSectionMoved) self.propertyTableHeader = self.widget.propertyTable.horizontalHeader() settings.setHeaderSectionSizes( self.propertyTableHeader, self.app.settings.value( 'locationbrowserwidget/PropertyHeaderSectionSizes', [])) self.propertyTableHeader.sectionResized.connect( self._slotPropertyTableSectionResized) settings.setSplitterState( self.widget.splitter1, self.app.settings.value('locationbrowserwidget/splitter1State', None)) self.widget.splitter1.splitterMoved.connect(self._slotSplitter1Moved) settings.setSplitterState( self.widget.splitter2, self.app.settings.value('locationbrowserwidget/splitter2State', None)) self.widget.splitter2.splitterMoved.connect(self._slotSplitter2Moved) self.widget.showUnknownCheckBox.setChecked( self.sortProxyModel.showUnknown) self.widget.showUnknownCheckBox.stateChanged.connect( self.sortProxyModel.showUnknownLocations) self.widget.filterNameLineEdit.textEdited.connect( self.sortProxyModel.setNameFilterString) self.dataManager = datamanager self.dataManager.registerRootObjectListener(self._onPipRootObjectEvent)