mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-05 00:09:32 -04:00
Cleanup files
This commit is contained in:
parent
13bc09e706
commit
7925d7261e
@ -46,6 +46,7 @@ from qgis.core import Qgis, QgsApplication, QgsMessageLog, QgsNetworkAccessManag
|
||||
from qgis.gui import QgsMessageBar, QgsPasswordLineEdit, QgsHelp
|
||||
from qgis.utils import (iface, startPlugin, unloadPlugin, loadPlugin, OverrideCursor,
|
||||
reloadPlugin, updateAvailablePlugins, plugins_metadata_parser, isPluginLoaded)
|
||||
from qgis import utils
|
||||
from .installer_data import (repositories, plugins, officialRepo,
|
||||
reposGroup, removeDir)
|
||||
from .qgsplugininstallerinstallingdialog import QgsPluginInstallerInstallingDialog
|
||||
@ -322,7 +323,7 @@ class QgsPluginInstaller(QObject):
|
||||
dlg = QgsPluginInstallerInstallingDialog(iface.mainWindow(), plugin, stable=stable)
|
||||
dlg.exec_()
|
||||
|
||||
plugin_path = qgis.utils.home_plugin_path + "/" + key
|
||||
plugin_path = utils.home_plugin_path + "/" + key
|
||||
if dlg.result():
|
||||
error = True
|
||||
infoString = (self.tr("Plugin installation failed"), dlg.result())
|
||||
@ -386,7 +387,7 @@ class QgsPluginInstaller(QObject):
|
||||
dlg.exec_()
|
||||
if dlg.result():
|
||||
# revert installation
|
||||
pluginDir = qgis.utils.home_plugin_path + "/" + plugin["id"]
|
||||
pluginDir = utils.home_plugin_path + "/" + plugin["id"]
|
||||
result = removeDir(pluginDir)
|
||||
if QDir(pluginDir).exists():
|
||||
error = True
|
||||
@ -435,7 +436,7 @@ class QgsPluginInstaller(QObject):
|
||||
unloadPlugin(key)
|
||||
except:
|
||||
pass
|
||||
pluginDir = qgis.utils.home_plugin_path + "/" + plugin["id"]
|
||||
pluginDir = utils.home_plugin_path + "/" + plugin["id"]
|
||||
result = removeDir(pluginDir)
|
||||
if result:
|
||||
QApplication.restoreOverrideCursor()
|
||||
@ -611,7 +612,7 @@ class QgsPluginInstaller(QObject):
|
||||
QgsHelp.openHelp("plugins/plugins.html#the-install-from-zip-tab")
|
||||
return
|
||||
|
||||
pluginsDirectory = qgis.utils.home_plugin_path
|
||||
pluginsDirectory = utils.home_plugin_path
|
||||
if not QDir(pluginsDirectory).exists():
|
||||
QDir().mkpath(pluginsDirectory)
|
||||
|
||||
|
@ -30,6 +30,7 @@ from qgis.PyQt.QtWidgets import QDialog
|
||||
from qgis.PyQt.QtNetwork import QNetworkRequest, QNetworkReply
|
||||
|
||||
from qgis.core import QgsNetworkAccessManager, QgsApplication, QgsNetworkRequestParameters
|
||||
from qgis import utils
|
||||
|
||||
from .ui_qgsplugininstallerinstallingbase import Ui_QgsPluginInstallerInstallingDialogBase
|
||||
from .installer_data import removeDir, repositories
|
||||
@ -141,7 +142,7 @@ class QgsPluginInstallerInstallingDialog(QDialog, Ui_QgsPluginInstallerInstallin
|
||||
self.file.close()
|
||||
self.stateChanged(0)
|
||||
reply.deleteLater()
|
||||
pluginDir = qgis.utils.home_plugin_path
|
||||
pluginDir = utils.home_plugin_path
|
||||
tmpPath = self.file.fileName()
|
||||
# make sure that the parent directory exists
|
||||
if not QDir(pluginDir).exists():
|
||||
|
@ -13,6 +13,8 @@ __copyright__ = 'Copyright 2017, The QGIS Project'
|
||||
from qgis.PyQt.QtCore import Qt
|
||||
from qgis.PyQt.QtTest import QSignalSpy
|
||||
import unittest
|
||||
|
||||
from qgis.gui import QgsCheckableComboBox
|
||||
from qgis.testing import start_app, QgisTestCase
|
||||
|
||||
start_app()
|
||||
@ -22,7 +24,7 @@ class TestQgsCheckableComboBox(QgisTestCase):
|
||||
|
||||
def testGettersSetters(self):
|
||||
""" test widget getters/setters """
|
||||
w = qgis.gui.QgsCheckableComboBox()
|
||||
w = QgsCheckableComboBox()
|
||||
|
||||
w.setSeparator('|')
|
||||
self.assertEqual(w.separator(), '|')
|
||||
@ -44,7 +46,7 @@ class TestQgsCheckableComboBox(QgisTestCase):
|
||||
def test_ChangedSignals(self):
|
||||
""" test that signals are correctly emitted when clearing"""
|
||||
|
||||
w = qgis.gui.QgsCheckableComboBox()
|
||||
w = QgsCheckableComboBox()
|
||||
|
||||
w.addItems(['One', 'Two', 'Three'])
|
||||
|
||||
@ -54,7 +56,7 @@ class TestQgsCheckableComboBox(QgisTestCase):
|
||||
self.assertEqual(len(checkedItemsChanged_spy), 1)
|
||||
|
||||
def test_readonly(self):
|
||||
w = qgis.gui.QgsCheckableComboBox()
|
||||
w = QgsCheckableComboBox()
|
||||
w.setEditable(False)
|
||||
w.show() # Should not crash
|
||||
|
||||
|
@ -11,6 +11,8 @@ __copyright__ = 'Copyright 2017, The QGIS Project'
|
||||
|
||||
|
||||
import unittest
|
||||
|
||||
from qgis.gui import QgsEncodingSelectionDialog
|
||||
from qgis.testing import start_app, QgisTestCase
|
||||
|
||||
start_app()
|
||||
@ -20,7 +22,7 @@ class TestQgsEncodingSelectionDialog(QgisTestCase):
|
||||
|
||||
def testGettersSetters(self):
|
||||
""" test dialog getters/setters """
|
||||
dlg = qgis.gui.QgsEncodingSelectionDialog(encoding='UTF-16')
|
||||
dlg = QgsEncodingSelectionDialog(encoding='UTF-16')
|
||||
self.assertEqual(dlg.encoding(), 'UTF-16')
|
||||
dlg.setEncoding('UTF-8')
|
||||
self.assertEqual(dlg.encoding(), 'UTF-8')
|
||||
|
@ -34,7 +34,7 @@ class TestQgsExtentGroupBox(QgisTestCase):
|
||||
|
||||
def testGettersSetters(self):
|
||||
""" test widget getters/setters """
|
||||
w = qgis.gui.QgsExtentGroupBox()
|
||||
w = QgsExtentGroupBox()
|
||||
|
||||
w.setOriginalExtent(QgsRectangle(1, 2, 3, 4), QgsCoordinateReferenceSystem('epsg:3111'))
|
||||
self.assertEqual(w.originalExtent(), QgsRectangle(1, 2, 3, 4))
|
||||
@ -80,7 +80,7 @@ class TestQgsExtentGroupBox(QgisTestCase):
|
||||
self.assertEqual(len(spy), 3)
|
||||
|
||||
def test_SettingExtent(self):
|
||||
w = qgis.gui.QgsExtentGroupBox()
|
||||
w = QgsExtentGroupBox()
|
||||
|
||||
spy = QSignalSpy(w.extentChanged)
|
||||
|
||||
@ -121,7 +121,7 @@ class TestQgsExtentGroupBox(QgisTestCase):
|
||||
QgsProject.instance().removeAllMapLayers()
|
||||
|
||||
def testSetOutputCrs(self):
|
||||
w = qgis.gui.QgsExtentGroupBox()
|
||||
w = QgsExtentGroupBox()
|
||||
w.setCheckable(True)
|
||||
|
||||
# ensure setting output crs doesn't change state of group box
|
||||
@ -146,7 +146,7 @@ class TestQgsExtentGroupBox(QgisTestCase):
|
||||
self.assertEqual(w.outputExtent().toString(20), QgsRectangle(1, 2, 3, 4).toString(20))
|
||||
|
||||
# repeat, this time using original extents
|
||||
w = qgis.gui.QgsExtentGroupBox()
|
||||
w = QgsExtentGroupBox()
|
||||
|
||||
w.setOutputCrs(QgsCoordinateReferenceSystem('epsg:4326'))
|
||||
w.setOriginalExtent(QgsRectangle(1, 2, 3, 4), QgsCoordinateReferenceSystem('epsg:4326'))
|
||||
@ -182,7 +182,7 @@ class TestQgsExtentGroupBox(QgisTestCase):
|
||||
self.assertEqual(w.outputExtent().toString(20), QgsRectangle(1, 2, 3, 4).toString(20))
|
||||
|
||||
# custom extent
|
||||
w = qgis.gui.QgsExtentGroupBox()
|
||||
w = QgsExtentGroupBox()
|
||||
|
||||
w.setOutputCrs(QgsCoordinateReferenceSystem('epsg:4326'))
|
||||
w.setOutputExtentFromUser(QgsRectangle(1, 2, 3, 4), QgsCoordinateReferenceSystem('epsg:4326'))
|
||||
|
@ -20,7 +20,10 @@ from qgis.core import (
|
||||
QgsRectangle,
|
||||
QgsVectorLayer,
|
||||
)
|
||||
from qgis.gui import QgsExtentWidget
|
||||
from qgis.gui import (
|
||||
QgsExtentWidget,
|
||||
QgsExtentGroupBox
|
||||
)
|
||||
import unittest
|
||||
from qgis.testing import start_app, QgisTestCase
|
||||
|
||||
@ -112,7 +115,7 @@ class TestQgsExtentWidget(QgisTestCase):
|
||||
self.assertEqual(w.outputExtent().toString(20), QgsRectangle(1, 2, 3, 4).toString(20))
|
||||
|
||||
# repeat, this time using original extents
|
||||
w = qgis.gui.QgsExtentGroupBox()
|
||||
w = QgsExtentGroupBox()
|
||||
|
||||
w.setOutputCrs(QgsCoordinateReferenceSystem('epsg:4326'))
|
||||
w.setOriginalExtent(QgsRectangle(1, 2, 3, 4), QgsCoordinateReferenceSystem('epsg:4326'))
|
||||
@ -148,7 +151,7 @@ class TestQgsExtentWidget(QgisTestCase):
|
||||
self.assertEqual(w.outputExtent().toString(20), QgsRectangle(1, 2, 3, 4).toString(20))
|
||||
|
||||
# custom extent
|
||||
w = qgis.gui.QgsExtentGroupBox()
|
||||
w = QgsExtentGroupBox()
|
||||
|
||||
w.setOutputCrs(QgsCoordinateReferenceSystem('epsg:4326'))
|
||||
w.setOutputExtentFromUser(QgsRectangle(1, 2, 3, 4), QgsCoordinateReferenceSystem('epsg:4326'))
|
||||
|
@ -12,11 +12,7 @@ __copyright__ = 'Copyright 2016, The QGIS Project'
|
||||
|
||||
from qgis.gui import QgsFilterLineEdit
|
||||
|
||||
try:
|
||||
from qgis.PyQt.QtTest import QSignalSpy
|
||||
use_signal_spy = True
|
||||
except:
|
||||
use_signal_spy = False
|
||||
from qgis.PyQt.QtTest import QSignalSpy
|
||||
|
||||
import unittest
|
||||
from qgis.testing import start_app, QgisTestCase
|
||||
@ -28,7 +24,7 @@ class TestQgsFilterLineEdit(QgisTestCase):
|
||||
|
||||
def testGettersSetters(self):
|
||||
""" test widget getters/setters """
|
||||
w = qgis.gui.QgsFilterLineEdit()
|
||||
w = QgsFilterLineEdit()
|
||||
|
||||
w.setNullValue('null')
|
||||
self.assertEqual(w.nullValue(), 'null')
|
||||
@ -46,7 +42,7 @@ class TestQgsFilterLineEdit(QgisTestCase):
|
||||
|
||||
def testNullValueHandling(self):
|
||||
""" test widget handling of null values """
|
||||
w = qgis.gui.QgsFilterLineEdit()
|
||||
w = QgsFilterLineEdit()
|
||||
|
||||
# start with no null value
|
||||
w.setValue(None)
|
||||
@ -77,7 +73,7 @@ class TestQgsFilterLineEdit(QgisTestCase):
|
||||
|
||||
def testClearToNull(self):
|
||||
""" test clearing widget """
|
||||
w = qgis.gui.QgsFilterLineEdit()
|
||||
w = QgsFilterLineEdit()
|
||||
|
||||
w.setValue('abc')
|
||||
w.clearValue()
|
||||
@ -97,7 +93,7 @@ class TestQgsFilterLineEdit(QgisTestCase):
|
||||
|
||||
def testClearToDefault(self):
|
||||
# test clearing to default value
|
||||
w = qgis.gui.QgsFilterLineEdit()
|
||||
w = QgsFilterLineEdit()
|
||||
w.setClearMode(QgsFilterLineEdit.ClearToDefault)
|
||||
|
||||
w.setValue('abc')
|
||||
@ -118,7 +114,7 @@ class TestQgsFilterLineEdit(QgisTestCase):
|
||||
|
||||
def test_selectedText(self):
|
||||
""" test that NULL value is selected on focus and not-null value is not"""
|
||||
w = qgis.gui.QgsFilterLineEdit(nullValue='my_null_value')
|
||||
w = QgsFilterLineEdit(nullValue='my_null_value')
|
||||
w.clearValue()
|
||||
self.assertEqual(w.selectedText(), 'my_null_value')
|
||||
|
||||
@ -128,11 +124,10 @@ class TestQgsFilterLineEdit(QgisTestCase):
|
||||
w.clearValue()
|
||||
self.assertEqual(w.selectedText(), 'my_null_value')
|
||||
|
||||
@unittest.skipIf(not use_signal_spy, "No QSignalSpy available")
|
||||
def test_ChangedSignals(self):
|
||||
""" test that signals are correctly emitted when clearing"""
|
||||
|
||||
w = qgis.gui.QgsFilterLineEdit()
|
||||
w = QgsFilterLineEdit()
|
||||
|
||||
cleared_spy = QSignalSpy(w.cleared)
|
||||
w.setValue('1')
|
||||
|
@ -40,7 +40,7 @@ class TestQgsFloatingWidget(QgisTestCase):
|
||||
main_frame.setAttribute(103)
|
||||
main_frame.show()
|
||||
|
||||
fw = qgis.gui.QgsFloatingWidget(main_frame)
|
||||
fw = QgsFloatingWidget(main_frame)
|
||||
fw.setMinimumSize(100, 50)
|
||||
fw.setAnchorWidget(anchor_widget)
|
||||
|
||||
@ -89,7 +89,7 @@ class TestQgsFloatingWidget(QgisTestCase):
|
||||
main_frame.setAttribute(103)
|
||||
main_frame.show()
|
||||
|
||||
fw = qgis.gui.QgsFloatingWidget(main_frame)
|
||||
fw = QgsFloatingWidget(main_frame)
|
||||
fw.setMinimumSize(100, 50)
|
||||
fw.setAnchorWidget(anchor_widget)
|
||||
|
||||
@ -133,7 +133,7 @@ class TestQgsFloatingWidget(QgisTestCase):
|
||||
main_frame.setAttribute(103)
|
||||
main_frame.show()
|
||||
|
||||
fw = qgis.gui.QgsFloatingWidget(main_frame)
|
||||
fw = QgsFloatingWidget(main_frame)
|
||||
fw.setMinimumSize(100, 50)
|
||||
fw.setAnchorWidget(anchor_widget)
|
||||
|
||||
@ -171,7 +171,7 @@ class TestQgsFloatingWidget(QgisTestCase):
|
||||
main_frame.setAttribute(103)
|
||||
main_frame.show()
|
||||
|
||||
fw = qgis.gui.QgsFloatingWidget(main_frame)
|
||||
fw = QgsFloatingWidget(main_frame)
|
||||
fw.setMinimumSize(300, 50)
|
||||
fw.setAnchorWidget(anchor_widget)
|
||||
|
||||
|
@ -9,6 +9,7 @@ __author__ = 'Nyall Dawson'
|
||||
__date__ = '18/07/2017'
|
||||
__copyright__ = 'Copyright 2017, The QGIS Project'
|
||||
|
||||
import unittest
|
||||
|
||||
from qgis.core import (
|
||||
QgsLayout,
|
||||
@ -18,7 +19,7 @@ from qgis.core import (
|
||||
QgsProject,
|
||||
QgsUnitTypes,
|
||||
)
|
||||
import unittest
|
||||
from qgis.gui import QgsLayoutItemPropertiesDialog
|
||||
from qgis.testing import start_app, QgisTestCase
|
||||
|
||||
start_app()
|
||||
@ -28,7 +29,7 @@ class TestQgsLayoutItemPropertiesDialog(QgisTestCase):
|
||||
|
||||
def testGettersSetters(self):
|
||||
""" test dialog getters/setters """
|
||||
dlg = qgis.gui.QgsLayoutItemPropertiesDialog()
|
||||
dlg = QgsLayoutItemPropertiesDialog()
|
||||
|
||||
l = QgsLayout(QgsProject.instance())
|
||||
l.initializeDefaults()
|
||||
|
@ -11,7 +11,11 @@ __copyright__ = 'Copyright 2017, The QGIS Project'
|
||||
|
||||
from qgis.PyQt.QtTest import QSignalSpy
|
||||
from qgis.PyQt.QtWidgets import QDoubleSpinBox
|
||||
from qgis.core import QgsLayoutMeasurementConverter, QgsUnitTypes
|
||||
from qgis.core import (
|
||||
QgsLayoutMeasurementConverter,
|
||||
QgsUnitTypes
|
||||
)
|
||||
from qgis.gui import QgsLayoutUnitsComboBox
|
||||
import unittest
|
||||
from qgis.testing import start_app, QgisTestCase
|
||||
|
||||
@ -22,14 +26,14 @@ class TestQgsLayoutUnitsComboBox(QgisTestCase):
|
||||
|
||||
def testGettersSetters(self):
|
||||
""" test widget getters/setters """
|
||||
w = qgis.gui.QgsLayoutUnitsComboBox()
|
||||
w = QgsLayoutUnitsComboBox()
|
||||
|
||||
w.setUnit(QgsUnitTypes.LayoutPixels)
|
||||
self.assertEqual(w.unit(), QgsUnitTypes.LayoutPixels)
|
||||
|
||||
def test_ChangedSignals(self):
|
||||
""" test that signals are correctly emitted when setting unit"""
|
||||
w = qgis.gui.QgsLayoutUnitsComboBox()
|
||||
w = QgsLayoutUnitsComboBox()
|
||||
|
||||
spy = QSignalSpy(w.changed)
|
||||
w.setUnit(QgsUnitTypes.LayoutPixels)
|
||||
@ -39,7 +43,7 @@ class TestQgsLayoutUnitsComboBox(QgisTestCase):
|
||||
|
||||
def testLinkedWidgets(self):
|
||||
""" test linking spin boxes to combobox"""
|
||||
w = qgis.gui.QgsLayoutUnitsComboBox()
|
||||
w = QgsLayoutUnitsComboBox()
|
||||
self.assertFalse(w.converter())
|
||||
c = QgsLayoutMeasurementConverter()
|
||||
w.setConverter(c)
|
||||
|
@ -11,6 +11,7 @@ __copyright__ = 'Copyright 2017, The QGIS Project'
|
||||
|
||||
|
||||
from qgis.PyQt.QtTest import QSignalSpy
|
||||
from qgis.gui import QgsOpacityWidget
|
||||
import unittest
|
||||
from qgis.testing import start_app, QgisTestCase
|
||||
|
||||
@ -21,7 +22,7 @@ class TestQgsOpacityWidget(QgisTestCase):
|
||||
|
||||
def testGettersSetters(self):
|
||||
""" test widget getters/setters """
|
||||
w = qgis.gui.QgsOpacityWidget()
|
||||
w = QgsOpacityWidget()
|
||||
|
||||
w.setOpacity(0.2)
|
||||
self.assertEqual(w.opacity(), 0.2)
|
||||
@ -35,7 +36,7 @@ class TestQgsOpacityWidget(QgisTestCase):
|
||||
def test_ChangedSignals(self):
|
||||
""" test that signals are correctly emitted when setting opacity"""
|
||||
|
||||
w = qgis.gui.QgsOpacityWidget()
|
||||
w = QgsOpacityWidget()
|
||||
|
||||
spy = QSignalSpy(w.opacityChanged)
|
||||
w.setOpacity(0.2)
|
||||
|
@ -9,9 +9,11 @@ __author__ = 'Nyall Dawson'
|
||||
__date__ = '18/07/2017'
|
||||
__copyright__ = 'Copyright 2017, The QGIS Project'
|
||||
|
||||
import unittest
|
||||
|
||||
from qgis.PyQt.QtWidgets import QDoubleSpinBox
|
||||
import unittest
|
||||
|
||||
from qgis.gui import QgsRatioLockButton
|
||||
from qgis.testing import start_app, QgisTestCase
|
||||
|
||||
start_app()
|
||||
@ -21,7 +23,7 @@ class TestQgsRatioLockButton(QgisTestCase):
|
||||
|
||||
def testLinkedWidgets(self):
|
||||
""" test linking spin boxes to combobox"""
|
||||
w = qgis.gui.QgsRatioLockButton()
|
||||
w = QgsRatioLockButton()
|
||||
|
||||
spin_width = QDoubleSpinBox()
|
||||
spin_width.setMaximum(100000)
|
||||
@ -94,7 +96,7 @@ class TestQgsRatioLockButton(QgisTestCase):
|
||||
self.assertEqual(spin_height.value(), 1000)
|
||||
|
||||
def testResetRatio(self):
|
||||
w = qgis.gui.QgsRatioLockButton()
|
||||
w = QgsRatioLockButton()
|
||||
|
||||
spin_width = QDoubleSpinBox()
|
||||
spin_width.setMaximum(100000)
|
||||
|
Loading…
x
Reference in New Issue
Block a user