Esempio n. 1
1
    def save_pref(self):
        pref = {}
        loc = self.getLocation()
        pref['X'] = loc.x
        pref['Y'] = loc.y
        size = self.getSize()
        pref['WIDTH'] = size.width
        pref['HEIGHT'] = size.height
        pref['DIVIDER'] = self.split.getDividerLocation()

        tree = []
        root = self.tree.getModel().getRoot()
        for i in range(root.getChildCount()):
            snode = root.getChildAt(i)
            params=[]
            for j in range(snode.getChildCount()):
                param = snode.getChildAt(j).getUserObject().conn_param
                if not param.save_password:
                    param.password = None   # Clear password
                params.append(param)
            tree.append([snode.toString(), params])
        pref['TREE'] = tree

        prefs = Preferences.userRoot().node('/org/nakagami/jbconsole')
        s = pickle.dumps(pref)
        prefs.put(APP_NAME, s) 
        prefs.flush()
 def __init__(self):
     from java.util.prefs import Preferences
 
     prefs=Preferences.userRoot().node("gov.ca.dsm2.calibration.compare");
     
     self.type=JTextField(prefs.get("type","EC"),15)
     self.stime=JTextField(prefs.get("stime","02JUL2001 0000"),15)
     self.etime=JTextField(prefs.get("etime","31DEC2001 0000"),15)
     self.fileobs=JTextField(prefs.get("file.obs","Z:/condor_jobs_cmaes/output_obs/Observed_data_all_forViz.dss"),25)
     self.filerun1=JTextField(prefs.get("file.run1","Z:/condor_jobs_cmaes/output_obs/previous_run_results/hist_mini_calib_v811_317.dss"),25)
     self.filerun2=JTextField(prefs.get("file.run2","Z:/condor_jobs_cmaes/output_test/hist_mini_calib_v811_0.dss"),25)
     self.image_dir=JTextField(prefs.get("image.dir","d:/temp"),25)
     self.locations=JTextField(prefs.get("locations","RSAC077,RSAN007,RSAC081,RSAC092,RSAN018,RSAN032,ROLD024,CLIFTON_COURT"),35)
     
     self.runButton=JButton("Run",actionPerformed=self.dorun)
     from net.miginfocom.swing import MigLayout
     self.setLayout(MigLayout())
     self.add(JLabel("Output Type"))
     self.add(self.type,"wrap")
     self.add(JLabel("Start Time"))
     self.add(self.stime,"gap unrelated")
     self.add(JLabel("End Time"))
     self.add(self.etime,"wrap")
     self.add(JLabel("Observed File:"))
     self.add(self.fileobs,"spanx, growx")
     self.add(JLabel("Run1 File:"))
     self.add(self.filerun1,"spanx, growx")
     self.add(JLabel("Run2 File:"))
     self.add(self.filerun2,"spanx, growx")
     self.add(JLabel("Image Directory"))
     self.add(self.image_dir,"spanx, growx")
     self.add(JLabel("Locations"))
     self.add(self.locations,"spanx, growx")
     self.add(self.runButton)
Esempio n. 3
0
    def __init__(self, path, userMode):
        path = path.replace('.', '/')
        if not path.startswith('/'):
            path = '/' + path

        if userMode:
            self._delegate = JavaPreferences.userRoot().node(path)
        else:
            self._delegate = JavaPreferences.systemRoot().node(path)
Esempio n. 4
0
 def load_pref(self):
     try:
         self.pref = pickle.loads(
             Preferences.userRoot().node('/org/nakagami/jbconsole').get(APP_NAME, None))
     except:
         self.pref = {}
     self.pref.setdefault('X', 0)
     self.pref.setdefault('Y', 0)
     self.pref.setdefault('WIDTH', 800)
     self.pref.setdefault('HEIGHT', 600)
     self.pref.setdefault('DIVIDER', 200)
     self.pref.setdefault('TREE', [])
    def dorun(self, event):
        doall(str.split(str(self.locations.text),","),str(self.fileobs.text),str(self.filerun1.text),str(self.filerun2.text),str(self.stime.text),str(self.etime.text),str(self.image_dir.text),None)

        from java.util.prefs import Preferences
        prefs=Preferences.userRoot().node("gov.ca.dsm2.calibration.compare");
        prefs.put("type",self.type.text)
        prefs.put("stime",self.stime.text)
        prefs.put("etime",self.etime.text)
        prefs.put("file.obs",self.fileobs.text)
        prefs.put("file.run1",self.filerun1.text)
        prefs.put("file.run2",self.filerun2.text)
        prefs.put("image.dir",self.image_dir.text)
        prefs.put("locations",self.locations.text)
Esempio n. 6
0
    def __init__(self):
        from java.util.prefs import Preferences

        prefs = Preferences.userRoot().node("gov.ca.dsm2.calibration.compare")

        self.type = JTextField(prefs.get("type", "EC"), 15)
        self.stime = JTextField(prefs.get("stime", "02JUL2001 0000"), 15)
        self.etime = JTextField(prefs.get("etime", "31DEC2001 0000"), 15)
        self.fileobs = JTextField(
            prefs.get(
                "file.obs",
                "Z:/condor_jobs_cmaes/output_obs/Observed_data_all_forViz.dss"
            ), 25)
        self.filerun1 = JTextField(
            prefs.get(
                "file.run1",
                "Z:/condor_jobs_cmaes/output_obs/previous_run_results/hist_mini_calib_v811_317.dss"
            ), 25)
        self.filerun2 = JTextField(
            prefs.get(
                "file.run2",
                "Z:/condor_jobs_cmaes/output_test/hist_mini_calib_v811_0.dss"),
            25)
        self.image_dir = JTextField(prefs.get("image.dir", "d:/temp"), 25)
        self.locations = JTextField(
            prefs.get(
                "locations",
                "RSAC077,RSAN007,RSAC081,RSAC092,RSAN018,RSAN032,ROLD024,CLIFTON_COURT"
            ), 35)

        self.runButton = JButton("Run", actionPerformed=self.dorun)
        from net.miginfocom.swing import MigLayout
        self.setLayout(MigLayout())
        self.add(JLabel("Output Type"))
        self.add(self.type, "wrap")
        self.add(JLabel("Start Time"))
        self.add(self.stime, "gap unrelated")
        self.add(JLabel("End Time"))
        self.add(self.etime, "wrap")
        self.add(JLabel("Observed File:"))
        self.add(self.fileobs, "spanx, growx")
        self.add(JLabel("Run1 File:"))
        self.add(self.filerun1, "spanx, growx")
        self.add(JLabel("Run2 File:"))
        self.add(self.filerun2, "spanx, growx")
        self.add(JLabel("Image Directory"))
        self.add(self.image_dir, "spanx, growx")
        self.add(JLabel("Locations"))
        self.add(self.locations, "spanx, growx")
        self.add(self.runButton)
Esempio n. 7
0
def openGVL():
    from javax.swing import JFileChooser
    GUIUtil=PluginServices.getPluginServices("com.iver.cit.gvsig.cad").getClassLoader().loadClass("com.iver.cit.gvsig.gui.GUIUtil")
    chooser = JFileChooser()
    chooser.setFileFilter(GUIUtil().createFileFilter("GVL Legend File",["gvl"]))
    from java.util.prefs import Preferences
    lastPath = Preferences.userRoot().node("gvsig.foldering").get("DataFolder", "null")
    chooser.setCurrentDirectory(File(lastPath))
    chooser.setFileSelectionMode(JFileChooser.FILES_ONLY)
    returnVal = chooser.showOpenDialog(None)
    if returnVal == chooser.APPROVE_OPTION:
        gvlPath = chooser.getSelectedFile().getPath()
    elif returnVal == chooser.CANCEL_OPTION:
        JOptionPane.showMessageDialog(None, "You have to open a .gvl file. Retry!","Batch Legend",JOptionPane.WARNING_MESSAGE)
        gvlPath = ""
    return gvlPath
Esempio n. 8
0
    def dorun(self, event):
        doall(str.split(str(self.locations.text), ","), str(self.fileobs.text),
              str(self.filerun1.text), str(self.filerun2.text),
              str(self.stime.text), str(self.etime.text),
              str(self.image_dir.text), None)

        from java.util.prefs import Preferences
        prefs = Preferences.userRoot().node("gov.ca.dsm2.calibration.compare")
        prefs.put("type", self.type.text)
        prefs.put("stime", self.stime.text)
        prefs.put("etime", self.etime.text)
        prefs.put("file.obs", self.fileobs.text)
        prefs.put("file.run1", self.filerun1.text)
        prefs.put("file.run2", self.filerun2.text)
        prefs.put("image.dir", self.image_dir.text)
        prefs.put("locations", self.locations.text)