Beispiel #1
0
    def run(self):
        """Run method that performs all the real work"""

        is_open = QSettings().value("ckan_browser/isopen", False)
        #Python treats almost everything as True````
        #is_open = bool(is_open)
        self.util.msg_log(u'isopen: {0}'.format(is_open))

        #!!!string comparison - Windows and Linux treat it as string, Mac as bool
        # so we convert string to bool
        if isinstance(is_open, basestring):
            is_open = self.util.str2bool(is_open)

        if is_open:
            self.util.msg_log(u'Dialog already opened')
            return

        # auf URL testen
        dir_check = self.util.check_dir(self.settings.cache_dir)
        api_url_check = self.util.check_api_url(self.settings.ckan_url)
        if dir_check is False or api_url_check is False:
            dlg = CKANBrowserDialogSettings(self.settings, self.iface,
                                            self.iface.mainWindow())
            dlg.show()
            result = dlg.exec_()
            if result != 1:
                return

#         self.util.msg_log('cache_dir: {0}'.format(self.settings.cache_dir))

        try:
            QSettings().setValue("ckan_browser/isopen", True)
            self.dlg = CKANBrowserDialog(self.settings, self.iface,
                                         self.iface.mainWindow())

            # show the dialog
            self.dlg.show()
            #self.dlg.open()
            # Run the dialog event loop
            result = self.dlg.exec_()
            # See if OK was pressed
            if result:
                # Do something useful here - delete the line containing pass and
                # substitute with your code.
                pass
        finally:
            QSettings().setValue("ckan_browser/isopen", False)
    def run(self):
        """Run method that performs all the real work"""
        
        is_open = QSettings().value("ckan_browser/isopen", False)
        #Python treats almost everything as True````
        #is_open = bool(is_open)
        self.util.msg_log(u'isopen: {0}'.format(is_open))
        
        #!!!string comparison - Windows and Linux treat it as string, Mac as bool
        # so we convert string to bool
        if isinstance(is_open, basestring):
            is_open = self.util.str2bool(is_open)
        
        if is_open:
            self.util.msg_log(u'Dialog already opened')
            return
        
        # auf URL testen
        dir_check = self.util.check_dir(self.settings.cache_dir)
        api_url_check = self.util.check_api_url(self.settings.ckan_url)
        if dir_check is False or api_url_check is False:
            dlg = CKANBrowserDialogSettings(self.settings, self.iface, self.iface.mainWindow())
            dlg.show()
            result = dlg.exec_()
            if result != 1:
                return

#         self.util.msg_log('cache_dir: {0}'.format(self.settings.cache_dir))

        try: 
            QSettings().setValue("ckan_browser/isopen", True)
            self.dlg = CKANBrowserDialog(self.settings, self.iface, self.iface.mainWindow())
            
            # show the dialog
            self.dlg.show()
            #self.dlg.open()
            # Run the dialog event loop
            result = self.dlg.exec_()
            # See if OK was pressed
            if result:
                # Do something useful here - delete the line containing pass and
                # substitute with your code.
                pass
        finally: 
            QSettings().setValue("ckan_browser/isopen", False)
Beispiel #3
0
 def open_settings(self):
     dlg = CKANBrowserDialogSettings(self.settings, self.iface,
                                     self.iface.mainWindow())
     dlg.show()
     dlg.exec_()
 def open_settings(self):
     dlg = CKANBrowserDialogSettings(self.settings, self.iface, self.iface.mainWindow())
     dlg.show()
     dlg.exec_()