ticket_2422.diff

suggested patch for the problem - Martin Dobias, 2010-02-12 09:15 AM

Download (2.85 KB)

View differences:

python/plugins/plugin_installer/installer_gui.py (working copy)
26 26
from installer_data import *
27 27

  
28 28
try:
29
  from qgis.utils import startPlugin, unloadPlugin
29
  from qgis.utils import startPlugin, unloadPlugin, loadPlugin # QGIS >= 1.4
30
  from qgis.utils import updateAvailablePlugins # QGIS >= 1.5
30 31
except Exception:
31 32
  pass
32 33

  
......
592 593
      plugins.rebuild()
593 594
      QApplication.restoreOverrideCursor()
594 595
    else:
595
      try:
596
        exec ("sys.path_importer_cache.clear()")
597
        exec ("import %s" % plugin["localdir"])
598
        exec ("reload (%s)" % plugin["localdir"])
599
      except:
600
        pass
596
      if QGIS_14:
597
        if QGIS_15: # update the list of plugins in plugin handling routines
598
          updateAvailablePlugins()
599
        # try to load the plugin
600
        loadPlugin(plugin["localdir"])
601
      else: # QGIS < 1.4
602
        try:
603
          exec ("sys.path_importer_cache.clear()")
604
          exec ("import %s" % plugin["localdir"])
605
          exec ("reload (%s)" % plugin["localdir"])
606
        except:
607
          pass
601 608
      plugins.getAllInstalled()
602 609
      plugins.rebuild()
603 610
      plugin = plugins.all()[key]
604 611
      if not plugin["error"]:
605 612
        if previousStatus in ["not installed", "new"]:
606
          if QGIS_14: 
613
          if QGIS_14: # plugins can be started in python from QGIS >= 1.4
607 614
            infoString = (self.tr("Plugin installed successfully"), self.tr("Plugin installed successfully"))
608 615
            settings = QSettings()
609 616
            settings.setValue("/PythonPlugins/"+plugin["localdir"], QVariant(True))
617
            startPlugin(plugin["localdir"])
610 618
          else: infoString = (self.tr("Plugin installed successfully"), self.tr("Python plugin installed.\nNow you need to enable it in Plugin Manager."))
611 619
        else:
612 620
          infoString = (self.tr("Plugin reinstalled successfully"), self.tr("Python plugin reinstalled.\nYou need to restart Quantum GIS in order to reload it."))
613
        try:
614
          startPlugin(plugin["localdir"])
615
        except:
616
          pass
617 621
      else:
618 622
        if plugin["error"] == "incompatible":
619 623
          message = self.tr("The plugin is designed for a newer version of Quantum GIS. The minimum required version is:")
python/plugins/plugin_installer/installer_data.py (working copy)
58 58
  else:
59 59
    QGIS_MAJOR_VER = 0
60 60
  QGIS_14 = False
61
  QGIS_15 = False
61 62
except:
62 63
  QGIS_VER = QGis.QGIS_VERSION
63 64
  QGIS_MAJOR_VER = 1
64 65
  QGIS_14 = (QGIS_VER[2] > 3)
66
  QGIS_15 = (QGIS_VER[2] > 4)
65 67

  
66 68

  
67 69