Ejemplo n.º 1
0
    def signIn(self):

        try:
            cl = LMClient()
        except OutOfDateException, e:
            message = "Your plugin version is out of date, please update from the QGIS python plugin repository."
            QMessageBox.warning(self, "Problem...", message, QMessageBox.Ok)
Ejemplo n.º 2
0
    def __init__(self,
                 iface,
                 BASE_URL=None,
                 STATUS_URL=None,
                 REST_URL=None,
                 cancel_close=None,
                 okayButton=None,
                 ids=None,
                 initializeWithData=False,
                 outputfunc=None,
                 requestfunc=None,
                 client=None,
                 inputs={}):
        """
      @param initialREST: flag for REST instead of WPS for first call,needs
      to be replaced
      @param iface: QGIS interface object
      @param mode: describe process or execute mode, deprecated
      @param BASE_URL: constant for the url of a particular process
      @param STATUS_URL: constant for checking on status of a process
      @param cancel_close: cancel close button from dialog
      @param okayButton: Accept button from dialog
      @param inputGroup: input group object from dialog
      @param outputGroup: output group object from dialog
      @param statuslabel: statuslabel object from dialog
      @param progressbar: progress bar object from dialog
      @param ids: dictionary of ids from previous processes
      """

        self.RADids = ids
        self.REST_URL = REST_URL
        self.BASE_URL = BASE_URL
        self.STATUS_URL = STATUS_URL
        self.iface = iface
        self.cancel_close = cancel_close
        self.buttonOk = okayButton
        self.clientmethod = requestfunc
        self.outputfunction = None

        if client is None:
            client = LMClient()
        if initializeWithData:
            # the model, because of thread and signals, has to live in the
            # thread and the client lives in the model, so here we
            # just send it the client
            self.startThread(GENERIC_REQUEST,
                             outputfunc=outputfunc,
                             requestfunc=self.clientmethod,
                             client=client,
                             inputs=inputs)
Ejemplo n.º 3
0
        helpWindow = QtGui.QDialog()
        helpWindow.setWindowTitle("Lifemapper Help")
        self.help = QtGui.QWidget(helpWindow)
        #self.help.setWindowTitle('LmSDM Help')
        self.help.resize(600, 400)
        self.help.setMinimumSize(600, 400)
        self.help.setMaximumSize(1000, 1000)
        layout = QtGui.QVBoxLayout()
        helpDialog = QtGui.QTextBrowser()
        helpDialog.setOpenExternalLinks(True)
        #helpDialog.setSearchPaths(['documents'])
        helppath = os.path.dirname(
            os.path.realpath(__file__)) + '/documents/help.html'
        helpDialog.setSource(QtCore.QUrl.fromLocalFile(helppath))
        helpDialog.scrollToAnchor(self.helpAnchor)
        layout.addWidget(helpDialog)
        self.help.setLayout(layout)
        #if self.isModal():
        #   self.setModal(False)
        #self.help.show()
        helpWindow.exec_()

if __name__ == "__main__":
    #
    client = LMClient(userId='', pwd='')
    qApp = QtGui.QApplication(sys.argv)
    #d = PostScenarioDialog(match=True,scenarioId=204,client=client)
    d = PostScenarioDialog(client=client)
    d.show()
    sys.exit(qApp.exec_())
Ejemplo n.º 4
0

# ..............................................................................

    def help(self):
        self.help = QWidget()
        self.help.resize(600, 400)
        self.help.setMinimumSize(600, 400)
        self.help.setMaximumSize(1000, 1000)
        layout = QVBoxLayout()
        helpDialog = QTextBrowser()
        #helpDialog.setSearchPaths(['documents'])
        helppath = os.path.dirname(
            os.path.realpath(__file__)) + '/documents/help.html'
        helpDialog.setSource(QUrl.fromLocalFile(helppath))
        helpDialog.scrollToAnchor('uploadLayers')
        layout.addWidget(helpDialog)
        self.help.setLayout(layout)
        if self.isModal():
            self.setModal(False)
        self.help.show()

if __name__ == "__main__":
    #
    client = LMClient(userId='blank', pwd='blank')
    qApp = QApplication(sys.argv)
    d = UploadDialog(None, client=client)
    #d = AdvancedAlgo()
    d.show()
    sys.exit(qApp.exec_())
Ejemplo n.º 5
0
        #print "did not find "+clade["name"]+" in directory"


ids = [1074]
users = ['Workshop5']

import sys
import os
import_path = "/home/jcavner/workspace/lm3/components/LmClient/LmQGIS/V2/lifemapperTools/"
sys.path.append(os.path.join(import_path, 'LmShared'))
configPath = os.path.join(import_path, 'config', 'config.ini')
os.environ["LIFEMAPPER_CONFIG_FILE"] = configPath
from LmClient.lmClientLib import LMClient

for expId, user in zip(ids, users):

    client = LMClient(user, user)
    recMammals(mammalsDict, countDict)
    # post the json
    try:
        resp = client.rad.addTreeForExperiment(expId, jTree=mammalsDict)
    except:
        post = False
    else:
        post = resp
    print "POST ", post

    client = None

#with open('/home/jcavner/PhyloXM_Examples/african_mammal_realDealMX.json','w') as outfile:
#   simplejson.dump(mammalsDict,outfile,indent=4)
Ejemplo n.º 6
0
from LmClient.lmClientLib import LMClient


tiffDLoc = '/home/jcavner/Philippines_ScenarionLyrs_Downloaded/'

res = commands.getoutput('ls %s*.tif' % (tiffDLoc))  
tiffPaths = res.split('\n')





user = '******'
pwd = 'DermotYeti'

client = LMClient()
client.login(user,pwd)

for fullPath in tiffPaths:
   
   try:
      fullName = os.path.basename(fullPath).replace('.tif','')
      typeCodeName = fullName.split('_')[0]
      name = fullName.replace('_AEAC',"")
      
   
      typeCodeTitle = typeCodeName
      description = typeCodeName
      
      newCode = client.sdm.postTypeCode(typeCodeName, title=typeCodeTitle, description=description)
       
Ejemplo n.º 7
0
def buildClient(user='******', pwd='Dermot'):

    client = LMClient()
    client.login(user, pwd)
    return client
Ejemplo n.º 8
0
import os, sys
import csv
sys.path.append(
    '/home/jcavner/workspace/lm3/components/LmClient/LmQGIS/V2/lifemapperTools/LmShared'
)
configPath = '/home/jcavner/workspace/lm3/components/LmClient/LmQGIS/V2/lifemapperTools/config/config.ini'
os.environ["LIFEMAPPER_CONFIG_FILE"] = configPath

from LmClient.lmClientLib import LMClient
client = LMClient(userId='HuwPrice', pwd='HuwPrice')

#res = client.sdm.postExperiment('ATT_MAXENT',32,4395448,prjScns=[32],
#                                mdlMask=1569,prjMask=1569)
#print res
#print res.id

#
pam = client.rad.getPamCsv(529,
                           651,
                           headers=True,
                           filePath='/home/jcavner/csvTest/birds.csv')
print "done"
#pamiter = csv.reader(pam.splitlines(),delimiter=',')
#pamL = list(pamiter)
#print pamL[0]
#
#c = 0
#for y in pamL:
#   l =  y[3:]
#   lInt = map(int,l)
#