def __init__(self, collection_manager, collection_id): QObject.__init__(self) self._collection_manager = collection_manager self._collection_id = collection_id self.install_status = False self.error_message = None self.killed = False
def __init__( self, osm_file, layers=OSM_LAYERS, white_list_column=WHITE_LIST, delete_empty_layers=False, load_only=False, osm_conf=None): self.__osmFile = osm_file self.__layers = layers if not white_list_column: white_list_column = { 'multilinestrings': None, 'points': None, 'lines': None, 'multipolygons': None} self.__whiteListColumn = white_list_column self.__deleteEmptyLayers = delete_empty_layers self.__loadOnly = load_only # If an osm_conf is provided ? if not osm_conf: current_dir = dirname(realpath(__file__)) self._osm_conf = join(current_dir, 'QuickOSMconf.ini') else: self._osm_conf = osm_conf QObject.__init__(self)
def __init__(self, layer=None): """Constructor for the KeywordIO object. .. versionchanged:: 3.3 added optional layer parameter. """ QObject.__init__(self) self.layer = layer
def __init__(self, parent, context, webPage, layerType): QObject.__init__(self, parent) debug("OpenlayersController.__init__", 3) self.context = context self.layerType = layerType self.img = QImage() self.page = webPage self.page.loadFinished.connect(self.pageLoaded) # initial size for map self.page.setViewportSize(QSize(1, 1)) self.timerMapReady = QTimer() self.timerMapReady.setSingleShot(True) self.timerMapReady.setInterval(20) self.timerMapReady.timeout.connect(self.checkMapReady) self.timer = QTimer() self.timer.setInterval(100) self.timer.timeout.connect(self.checkMapUpdate) self.timerMax = QTimer() self.timerMax.setSingleShot(True) # TODO: different timeouts for map types self.timerMax.setInterval(2500) self.timerMax.timeout.connect(self.mapTimeout)
def __init__(self, data, parent=None): QObject.__init__(self, parent) self.populated = False self.itemData = data self.childItems = [] if parent: parent.appendChild(self)
def __init__(self): """Constructor for the metadataDbIO object.""" QObject.__init__(self) # path to sqlite db path self.metadata_db_path = None self.setup_metadata_db_path() self.connection = None
def __init__(self, iface, status_bar, progress_label, api, db_connections): QObject.__init__(self) self.iface = iface self.status_bar = status_bar self.progress_label = progress_label self.api = api self.db_connections = db_connections self.PROJECT_INSTANCE = QgsProject.instance()
def __init__(self, interface, settings): QObject.__init__(self) self.iface = interface self.settings = settings self.stop = False self.util = Util(self.iface) self.intersections = [] self.cadastre = []
def __init__(self, iface): QObject.__init__(self) """Constructor. # :param iface: An interface instance that will be passed to this class which provides the hook by which you can manipulate the QGIS application at run time. :type iface: QgsInterface """ # Save reference to the QGIS interface self.iface = iface # initialize plugin directory self.plugin_dir = os.path.dirname(__file__) # initialize locale locale = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join( self.plugin_dir, 'i18n', 'MagneticDeclination_{}.qm'.format(locale)) # if os.path.exists(locale_path): self.translator = QTranslator() self.translator.load(locale_path) # if qVersion() > '4.3.3': QCoreApplication.installTranslator(self.translator) # # Create the dialog (after translation) and keep reference self.dlg = MagneticDeclinationDialog() # # Declare instance attributes self.actions = [] self.menu = self.tr(u'&Magnetic Declination') # TODO: We are going to let the user set this up in a future iteration self.toolbar = self.iface.addToolBar(u'MagneticDeclination') self.toolbar.setObjectName(u'MagneticDeclination') # #DECLARATION self.dlg.Calculate_Button.clicked.connect(self.simple_Calculate) self.dlg.FromMap_Button.clicked.connect(self.simple_FromMap) self.dlg.Compass_Button.clicked.connect(self.simple_Compass) self.dlg.Cancel_Button.clicked.connect(self.simple_Cancel) self.dlg.meter_radioButton.clicked.connect(self.simple_Meter) self.dlg.feet_radioButton.clicked.connect(self.simple_Feet) self.dlg.toMagnetic_radioButton.clicked.connect(self.simple_ToMag) self.dlg.toTrue_radioButton.clicked.connect(self.simple_ToTrue) self.dlg.color_toolButton.clicked.connect(self.simple_Kolors) # self.dlg.latitude_doubleSpinBox.valueChanged.connect(self.calcSenseLonLat) self.dlg.longitude_doubleSpinBox.valueChanged.connect(self.calcSenseLonLat) self.dlg.height_doubleSpinBox.valueChanged.connect(self.calcSense) self.dlg.heading_doubleSpinBox.valueChanged.connect(self.calcSense) self.dlg.d_spinBox.valueChanged.connect(self.calcSense) self.dlg.m_spinBox.valueChanged.connect(self.calcSense) self.dlg.y_spinBox.valueChanged.connect(self.calcSense) self.dlg.height_doubleSpinBox.valueChanged.connect(self.calcSense) self.dlg.date_groupBox.clicked.connect(self.calcSense) self.dlg.height_groupBox.clicked.connect(self.calcSense)
def __init__(self, dialog): QObject.__init__(self) self.dialog = dialog self.startTime = datetime.now() # common cadastre methods self.qc = self.dialog.qc self.defaultThemeDir = 'classique' self.themeDir = None # List of database layers to load in QGIS self.mainLayers = [ u'Communes', u'Sections', u'Parcelles', u'Bâti' ] self.qgisCadastreLayerList = [ {'label': u'Communes', 'name': 'geo_commune', 'table': 'geo_commune', 'geom': 'geom', 'sql': '', 'key': 'ogc_fid', 'active': True, 'group': 'C', 'subset': '"geo_commune" IN (%s)'}, {'label': u'Tronçons de route', 'name': 'geo_tronroute', 'table': 'geo_tronroute', 'geom': 'geom', 'sql': '', 'active': True, 'group': 'D'}, {'label': u'Voies, routes et chemins', 'name': 'geo_zoncommuni', 'table': 'geo_zoncommuni', 'geom': 'geom', 'sql': '', 'active': False, 'group': 'D'}, {'label': u'Noms de voies', 'name': 'geo_label_zoncommuni', 'table': 'geo_label', 'geom': 'geom', 'sql': '"ogr_obj_lnk_layer" IN ( \'ZONCOMMUNI_id\') ', 'active': True, 'group': 'E'}, {'label': u'Secteurs', 'name': 'geo_subdsect', 'table': 'geo_subdsect', 'geom': 'geom', 'sql': '', 'active': True, 'group': 'D'}, {'label': u'Subdivisions fiscales', 'name': 'geo_subdfisc', 'table': 'geo_subdfisc', 'geom': 'geom', 'sql': '', 'active': True, 'group': 'D'}, {'label': u'Subdivisions fiscales (étiquette)', 'name': 'geo_label_subdfisc', 'table': 'geo_label', 'geom': 'geom', 'sql': '"ogr_obj_lnk_layer" = \'SUBDFISC_id\'', 'active': False, 'group': 'E'}, {'label': u'Bâti', 'name': 'geo_batiment', 'table': 'geo_batiment', 'geom': 'geom', 'sql': '', 'active': True, 'group': 'D'}, {'label': u'Parcelles (étiquettes)', 'name': 'geo_label_parcelle', 'table': 'geo_label', 'geom': 'geom', 'sql': '"ogr_obj_lnk_layer" = \'PARCELLE_id\'', 'active': True, 'group': 'E'}, {'label': u'Lieux-dits', 'name': 'geo_lieudit', 'table': 'geo_lieudit', 'geom': 'geom', 'sql': '', 'active': True, 'group': 'D'}, {'label': u'Lieux-dits (étiquettes)', 'name': 'geo_label_lieudit', 'table': 'geo_label', 'geom': 'geom', 'sql': '"ogr_obj_lnk_layer" = \'LIEUDIT_id\'', 'active': False, 'group': 'E'}, {'label': u'Sections', 'name': 'geo_section', 'table': 'geo_section', 'geom': 'geom', 'sql': '', 'key': 'ogc_fid', 'active': True, 'group': 'C', 'subset': '"geo_commune" IN (%s)'}, {'label': u'Parcelles', 'name': 'parcelle_info', 'table': 'parcelle_info', 'geom': 'geom', 'sql': '', 'key': 'ogc_fid', 'active': True, 'group': 'C', 'subset': 'substr("geo_parcelle", 1, 10) IN (%s)'}, {'label': u'Sections (étiquettes)', 'name': 'geo_label_section', 'table': 'geo_label', 'geom': 'geom', 'sql': '"ogr_obj_lnk_layer" = \'SECTION_id\'', 'active': False, 'group': 'E'}, {'label': u'Bornes', 'name': 'geo_borne', 'table': 'geo_borne', 'geom': 'geom', 'sql': '', 'active': False, 'group': 'D'}, {'label': u'Croix', 'name': 'geo_croix', 'table': 'geo_croix', 'geom': 'geom', 'sql': '', 'active': False, 'group': 'D'}, {'label': u'Repères géodésiques', 'name': 'geo_ptcanv', 'table': 'geo_ptcanv', 'geom': 'geom', 'sql': '', 'active': False, 'group': 'D'}, {'label': u'Murs, fossés, clotûres', 'name': 'geo_symblim', 'table': 'geo_symblim', 'geom': 'geom', 'sql': '', 'active': False, 'group': 'D'}, {'label': u'Cours d\'eau', 'name': 'geo_tronfluv', 'table': 'geo_tronfluv', 'geom': 'geom', 'sql': '', 'active': True, 'group': 'D'}, {'label': u'Cours d\'eau (étiquettes)', 'name': 'geo_label_tronfluv', 'table': 'geo_label', 'geom': 'geom', 'sql': '"ogr_obj_lnk_layer" = \'TRONFLUV_id\'', 'active': True, 'group': 'E'}, {'label': u'Tronçons de route (étiquettes)', 'name': 'geo_label_tronroute', 'table': 'geo_label', 'geom': 'geom', 'sql': '"ogr_obj_lnk_layer" = \'TRONROUTE_id\'', 'active': False, 'group': 'E'}, {'label': u'Surfaces', 'name': 'geo_tsurf', 'table': 'geo_tsurf', 'geom': 'geom', 'sql': '', 'active': True, 'group': 'D'}, {'label': u'Surfaces (étiquettes)', 'name': 'geo_label_tsurf', 'table': 'geo_label', 'geom': 'geom', 'sql': '"ogr_obj_lnk_layer" = \'TSURF_id\'', 'active': False, 'group': 'E'}, {'label': u'Objets ponctuels', 'name': 'geo_tpoint', 'table': 'geo_tpoint', 'geom': 'geom', 'sql': '', 'active': False, 'group': 'D'}, {'label': u'Objets ponctuels (étiquettes)', 'name': 'geo_label_tpoint', 'table': 'geo_label', 'geom': 'geom', 'sql': '"ogr_obj_lnk_layer" = \'TPOINT_id\'', 'active': False, 'group': 'E'}, {'label': u'Objets linéaires', 'name': 'geo_tline', 'table': 'geo_tline', 'geom': 'geom', 'sql': '', 'active': False, 'group': 'D'}, {'label': u'Objets linéaires (étiquettes)', 'name': 'geo_label_tline', 'table': 'geo_label', 'geom': 'geom', 'sql': '"ogr_obj_lnk_layer" = \'TLINE_id\'', 'active': False, 'group': 'E'}, {'label': u'Numéros de voie', 'name': 'geo_label_num_voie', 'table': 'geo_label', 'geom': 'geom', 'sql': '"ogr_obj_lnk_layer" = \'NUMVOIE_id\'', 'active': True, 'group': 'E'}, {'label': u'Établissements publics', 'name': 'geo_label_voiep', 'table': 'geo_label', 'geom': 'geom', 'sql': '"ogr_obj_lnk_layer" = \'VOIEP_id\'', 'active': True, 'group': 'E'} #, #{'label': u'Unités foncières', 'name': 'geo_unite_fonciere', 'table': 'geo_unite_fonciere', 'geom':'geom', 'sql': '', 'dbType': 'postgis', 'active': False, 'group': 'D'} ] # List of database layers to load in QGIS self.variableLayers = { 'Communes':{'var_key':'communes', 'unique_col':'geo_commune'}, 'Sections':{'var_key':'sections', 'unique_col':'geo_section'}, 'Parcelles':{'var_key':'parcelles', 'unique_col':'geo_parcelle'}, 'Bâti':{'var_key':'batiment', 'unique_col':'geo_batiment'}, }
def __init__(self, iface): QObject.__init__(self) self.iface = iface self.timeManagementEnabled = True self.timeLayerList = [] self.setProjectTimeExtents((None, None)) self.setCurrentTimePosition(None) self.timeFrameType = conf.DEFAULT_FRAME_UNIT self.timeFrameSize = conf.DEFAULT_FRAME_SIZE
def __init__(self, iface, model): """Initialize the GUI control""" QObject.__init__(self) self.iface = iface self.model = model self.optionsDialog = None self.path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'ui') # load the form self.dock = uic.loadUi(os.path.join(self.path, DOCK_WIDGET_FILE)) self.iface.addDockWidget(Qt.BottomDockWidgetArea, self.dock) self.dock.pushButtonExportVideo.setEnabled(False) # only enabled if there are managed layers self.dock.pushButtonOptions.clicked.connect(self.optionsClicked) self.dock.pushButtonExportVideo.clicked.connect(self.exportVideoClicked) self.dock.pushButtonToggleTime.clicked.connect(self.toggleTimeClicked) self.dock.pushButtonArchaeology.clicked.connect(self.archaeologyClicked) self.dock.pushButtonBack.clicked.connect(self.backClicked) self.dock.pushButtonForward.clicked.connect(self.forwardClicked) self.dock.pushButtonPlay.clicked.connect(self.playClicked) self.dock.dateTimeEditCurrentTime.dateTimeChanged.connect(self.currentTimeChangedDateText) # self.dock.horizontalTimeSlider.valueChanged.connect(self.currentTimeChangedSlider) self.sliderTimer = QTimer(self) self.sliderTimer.setInterval(250) self.sliderTimer.setSingleShot(True) self.sliderTimer.timeout.connect(self.currentTimeChangedSlider) self.dock.horizontalTimeSlider.valueChanged.connect(self.startTimer) self.dock.comboBoxTimeExtent.currentIndexChanged[str].connect(self.currentTimeFrameTypeChanged) self.dock.spinBoxTimeExtent.valueChanged.connect(self.currentTimeFrameSizeChanged) # this signal is responsible for rendering the label self.iface.mapCanvas().renderComplete.connect(self.renderLabel) # create shortcuts self.focusSC = QShortcut(QKeySequence("Ctrl+Space"), self.dock) self.focusSC.activated.connect(self.dock.horizontalTimeSlider.setFocus) # put default values self.dock.horizontalTimeSlider.setMinimum(conf.MIN_TIMESLIDER_DEFAULT) self.dock.horizontalTimeSlider.setMaximum(conf.MAX_TIMESLIDER_DEFAULT) self.dock.dateTimeEditCurrentTime.setMinimumDate(MIN_QDATE) self.showLabel = conf.DEFAULT_SHOW_LABEL self.exportEmpty = conf.DEFAULT_EXPORT_EMPTY self.labelOptions = TimestampLabelConfig(self.model) # placeholders for widgets that are added dynamically self.bcdateSpinBox = None # add to plugins toolbar try: self.action = QAction(QCoreApplication.translate("TimeManagerGuiControl", "Toggle visibility"), self.iface.mainWindow()) self.action.triggered.connect(self.toggleDock) self.iface.addPluginToMenu(QCoreApplication.translate("TimeManagerGuiControl", "&TimeManager"), self.action) except Exception as e: pass # OK for testing
def __init__(self, vlayers, infield, searchStr, comparisonMode, selectedField, maxResults): QObject.__init__(self) self.vlayers = vlayers self.infield = infield self.searchStr = searchStr self.comparisonMode = comparisonMode self.selectedField = selectedField self.killed = False self.maxResults = maxResults
def __init__(self, param, dialog, row=0, col=0): QObject.__init__(self) self.param = param self.dialog = dialog self.row = row self.col = col self.dialogType = dialogTypes.get(dialog.__class__.__name__, DIALOG_STANDARD) self.widget = self.createWidget() if param.default is not None: self.setValue(param.default)
def __init__(self): QObject.__init__(self) if LayerRegistry._instance is not None: return LayerRegistry.layers = self.getAllLayers() LayerRegistry._instance = self QgsMapLayerRegistry.instance().removeAll.connect(self.removeAllLayers) QgsMapLayerRegistry.instance().layerWasAdded.connect(self.layerAdded) QgsMapLayerRegistry.instance().layerWillBeRemoved.connect(self.removeLayer)
def __init__(self): QObject.__init__(self) self.plugins = dict() self.localCache = dict() self.repoCache = dict() try: from qgistester.tests import addTestModule from boundlessconnect.test import testplugin addTestModule(testplugin, "Boundless Connect") except Exception as ex: pass
def __init__(self): """ Initialize data objects, starts fetching if appropriate, and warn about/removes obsolete plugins """ QObject.__init__(self) # initialize QObject in order to to use self.tr() repositories.load() plugins.getAllInstalled() if repositories.checkingOnStart() and repositories.timeForChecking() and repositories.allEnabled(): # start fetching repositories self.statusLabel = QLabel(self.tr("Looking for new plugins...") + " ", iface.mainWindow().statusBar()) iface.mainWindow().statusBar().insertPermanentWidget(0, self.statusLabel) self.statusLabel.linkActivated.connect(self.showPluginManagerWhenReady) repositories.checkingDone.connect(self.checkingDone) for key in repositories.allEnabled(): repositories.requestFetching(key) else: # no fetching at start, so mark all enabled repositories as requesting to be fetched. for key in repositories.allEnabled(): repositories.setRepositoryData(key, "state", 3) # look for obsolete plugins (the user-installed one is newer than core one) for key in plugins.obsoletePlugins: plugin = plugins.localCache[key] msg = QMessageBox() msg.setIcon(QMessageBox.Warning) msg.setWindowTitle(self.tr("QGIS Python Plugin Installer")) msg.addButton(self.tr("Uninstall (recommended)"), QMessageBox.AcceptRole) msg.addButton(self.tr("I will uninstall it later"), QMessageBox.RejectRole) msg.setText( "%s <b>%s</b><br/><br/>%s" % ( self.tr("Obsolete plugin:"), plugin["name"], self.tr( "QGIS has detected an obsolete plugin that masks its more recent version shipped with this copy of QGIS. This is likely due to files associated with a previous installation of QGIS. Do you want to remove the old plugin right now and unmask the more recent version?" ), ) ) msg.exec_() if not msg.result(): # uninstall, update utils and reload if enabled self.uninstallPlugin(key, quiet=True) updateAvailablePlugins() settings = QSettings() if settings.value("/PythonPlugins/" + key, False, type=bool): settings.setValue("/PythonPlugins/watchDog/" + key, True) loadPlugin(key) startPlugin(key) settings.remove("/PythonPlugins/watchDog/" + key)
def __init__(self): """Constructor. ..note: - Directories is a list of repository that are registered in user's QGIS. Data structure of directories: self._directories = { 'QGIS Official Repository': { 'url': '[email protected]:anitagraser/QGIS-style-repo-dummy.git', 'auth_cfg': '0193jkad' } } - Repositories is a dictionary of repository with all the collections contained in that repository. Data structure of repositories: self._repositories = { repo_name: [{ 'register_name': collection, 'author': author, 'author_email': email, 'repository_url': self.url, 'status': COLLECTION_NOT_INSTALLED_STATUS, 'name': parser.get(collection, 'name'), 'tags': parser.get(collection, 'tags'), 'description': parser.get(collection, 'description'), 'qgis_min_version': '2.0', 'qgis_max_version': '2.99' 'preview': ['preview/image1.png', 'preview/image2.png'] }, .... //other collections from this repository ], ... //other repository } """ QObject.__init__(self) # Online directories from the DIRECTORY_URL self._online_directories = {} # Registered directories self._directories = {} # Registered repositories self._repositories = {} # Collection manager instance to deal with collections self._collections_manager = CollectionManager() # Fetch online directories self.fetch_online_directories() # Load directory of repositories from settings self.load_directories() # Load repositories from cache self.load_repositories()
def __init__(self, geturl_func, parseresult_func, parent = None): QObject.__init__(self, parent) self.geturl_func = geturl_func self.parseresult_func = parseresult_func self.editor = parent self.networkManager = QNetworkAccessManager() self.selectedObject = None self.isUnloaded = False self.popup = QTreeWidget(parent) #self.popup.setColumnCount(2) self.popup.setColumnCount(1) self.popup.setUniformRowHeights(True) self.popup.setRootIsDecorated(False) self.popup.setEditTriggers(QTreeWidget.NoEditTriggers) self.popup.setSelectionBehavior(QTreeWidget.SelectRows) self.popup.setFrameStyle(QFrame.Box | QFrame.Plain) self.popup.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.popup.header().hide() self.popup.installEventFilter(self) self.popup.setMouseTracking(True) #self.connect(self.popup, SIGNAL("itemClicked(QTreeWidgetItem*, int)"), # self.doneCompletion) self.popup.itemClicked.connect( self.doneCompletion ) self.popup.setWindowFlags(Qt.Popup) self.popup.setFocusPolicy(Qt.NoFocus) self.popup.setFocusProxy(parent) self.timer = QTimer(self) self.timer.setSingleShot(True) self.timer.setInterval(500) #self.connect(self.timer, SIGNAL("timeout()"), self.autoSuggest) self.timer.timeout.connect( self.autoSuggest ) #self.connect(self.editor, SIGNAL("textEdited(QString)"), self.timer, SLOT("start()")) #self.editor.textEdited.connect( self.timer.start ) self.editor.textEdited.connect( self.timer.start ) #self.editor.textChanged.connect( self.timer.start ) #self.connect(self.networkManager, SIGNAL("finished(QNetworkReply*)"), # self.handleNetworkData) self.networkManager.finished.connect( self.handleNetworkData )
def __init__(self, canvas): """Constructor :param canvas: """ QObject.__init__(self) self.canvas = canvas # Set up slots so we can mimic the behaviour of QGIS when layers # are added. LOGGER.debug('Initialising canvas...') # noinspection PyArgumentList QgsMapLayerRegistry.instance().layersAdded.connect(self.addLayers) # noinspection PyArgumentList QgsMapLayerRegistry.instance().layerWasAdded.connect(self.addLayer) # noinspection PyArgumentList QgsMapLayerRegistry.instance().removeAll.connect(self.removeAllLayers) # For processing module self.destCrs = None
def __init__(self, parent=None): QObject.__init__(self, parent) self.queue = [] self.requestingUrls = [] self.replies = [] self.eventLoop = QEventLoop() self.sync = False self.fetchedFiles = {} self.clearCounts() self.timer = QTimer() self.timer.setSingleShot(True) self.timer.timeout.connect(self.fetchTimedOut) # network settings self.userAgent = "Mozilla/5.0" self.max_connection = 4 self.default_cache_expiration = 24 self.errorStatus = Downloader.NO_ERROR
def __init__(self, parent=None): QObject.__init__(self, parent) self.queue = [] self.redirected_urls = {} self.requestingUrls = [] self.replies = [] self.eventLoop = QEventLoop() self.sync = False self.fetchedFiles = {} self.clearCounts() self.timer = QTimer() self.timer.setSingleShot(True) self.timer.timeout.connect(self.fetchTimedOut) # network settings self.userAgent = "QuickMapServices tile layer (+https://github.com/nextgis/quickmapservices)" self.max_connection = 4 self.default_cache_expiration = 24 self.errorStatus = Downloader.NO_ERROR
def __init__(self): QObject.__init__(self) self.mRepositories = {} self.httpId = {} # {httpId : repoName} self.mInspectionFilter = None
def __init__(self, tag=None): QObject.__init__(self) self.log = [] self.tag = tag
def __init__(self, key): QObject.__init__(self) self.key = key
def __init__(self, parent=None): QObject.__init__(self, parent)
def __init__(self, canvas): """Constructor""" QObject.__init__(self) self.canvas = canvas
def __init__(self, conn_name, parent=None): QObject.__init__(self, parent) self.connName = conn_name self.db = None
def __init__(self, api_lexer, api_files, pap_file): QObject.__init__(self) self._api = None self._api_files = api_files self._api_lexer = api_lexer self._pap_file = pap_file
def __init__(self): QObject.__init__(self) self.mPlugins = {} # the dict of plugins (dicts) self.repoCache = {} # the dict of lists of plugins (dicts) self.localCache = {} # the dict of plugins (dicts) self.obsoletePlugins = [] # the list of outdated 'user' plugins masking newer 'system' ones
def __init__(self, iface, model): """Initialize the GUI control""" QObject.__init__(self) self.iface = iface self.model = model self.optionsDialog = None self.path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'ui') # load the form self.dock = uic.loadUi(os.path.join(self.path, DOCK_WIDGET_FILE)) self.iface.addDockWidget(Qt.BottomDockWidgetArea, self.dock) self.dock.pushButtonExportVideo.setEnabled( False) # only enabled if there are managed layers self.dock.pushButtonOptions.clicked.connect(self.optionsClicked) self.dock.pushButtonExportVideo.clicked.connect( self.exportVideoClicked) self.dock.pushButtonToggleTime.clicked.connect(self.toggleTimeClicked) self.dock.pushButtonArchaeology.clicked.connect( self.archaeologyClicked) self.dock.pushButtonBack.clicked.connect(self.backClicked) self.dock.pushButtonForward.clicked.connect(self.forwardClicked) self.dock.pushButtonPlay.clicked.connect(self.playClicked) self.dock.dateTimeEditCurrentTime.dateTimeChanged.connect( self.currentTimeChangedDateText) # self.dock.horizontalTimeSlider.valueChanged.connect(self.currentTimeChangedSlider) self.sliderTimer = QTimer(self) self.sliderTimer.setInterval(250) self.sliderTimer.setSingleShot(True) self.sliderTimer.timeout.connect(self.currentTimeChangedSlider) self.dock.horizontalTimeSlider.valueChanged.connect(self.startTimer) self.dock.comboBoxTimeExtent.currentIndexChanged[str].connect( self.currentTimeFrameTypeChanged) self.dock.spinBoxTimeExtent.valueChanged.connect( self.currentTimeFrameSizeChanged) # this signal is responsible for rendering the label self.iface.mapCanvas().renderComplete.connect(self.renderLabel) # create shortcuts self.focusSC = QShortcut(QKeySequence("Ctrl+Space"), self.dock) self.focusSC.activated.connect(self.dock.horizontalTimeSlider.setFocus) # put default values self.dock.horizontalTimeSlider.setMinimum(conf.MIN_TIMESLIDER_DEFAULT) self.dock.horizontalTimeSlider.setMaximum(conf.MAX_TIMESLIDER_DEFAULT) self.dock.dateTimeEditCurrentTime.setMinimumDate(MIN_QDATE) self.showLabel = conf.DEFAULT_SHOW_LABEL self.exportEmpty = conf.DEFAULT_EXPORT_EMPTY self.labelOptions = TimestampLabelConfig(self.model) # placeholders for widgets that are added dynamically self.bcdateSpinBox = None # add to plugins toolbar try: self.action = QAction( QCoreApplication.translate("TimeManagerGuiControl", "Toggle visibility"), self.iface.mainWindow()) self.action.triggered.connect(self.toggleDock) self.iface.addPluginToMenu( QCoreApplication.translate("TimeManagerGuiControl", "&TimeManager"), self.action) except Exception as e: pass # OK for testing
def __init__(self, table): QObject.__init__(self, table)