コード例 #1
0
    def __init__(self, view, name, func, args=(), label=None):

        core.DataViewComponent.__init__(self, label)

        self.OSname = java.lang.System.getProperty("os.name").lower()
        if OSname.find("win") > -1:
            self.sourcedir = 'F:\\Peter\\Dropbox\\CS 750 - Eliasmith\\Project\\Solution'
            self.graphicsDir = "F:\\Peter\\Dropbox\\CS 750 - Eliasmith\\Project\\Solution"
            self.fileSep = "\\"
        elif OSname.find("linux") > -1:
            self.sourcedir = r'/home/ctnuser/Pete/ratmaze1'
            self.graphicsDir = r'/home/ctnuser/Pete/ratmaze1'
            self.fileSep = "/"

        #logging.warning("\\n\\n\\n CREATED ANOTHER DEMO VIEW INSTANCE!!! -------------[%s]---------------\\n\\n" % (id(self)) )

        self.view = view
        self.name = name
        self.func = func
        self.show_label = False
        self.update_label()

        self.TraceOn = False

        self.data = self.view.watcher.watch(name, func, args=args)

        # icons...
        self.ratFile = io.File(self.graphicsDir + self.fileSep + "Rat.png")
        self.ratImage = imageio.ImageIO.read(self.ratFile)

        self.cheeseLeversFile = io.File(self.graphicsDir + self.fileSep +
                                        "cheeseLevers.png")
        self.cheeseLeversImage = imageio.ImageIO.read(self.cheeseLeversFile)

        self.goLightfile = io.File(self.graphicsDir + self.fileSep +
                                   "golight.png")
        self.goLightImage = imageio.ImageIO.read(self.goLightfile)

        self.RatWinsfile = io.File(self.graphicsDir + self.fileSep +
                                   "RatWins.png")
        self.RatWinsImage = imageio.ImageIO.read(self.RatWinsfile)

        self.TrainingGraphFile = self.graphicsDir + self.fileSep + "MappedMoves.png"

        self.QLearnTrainingGraphFile = self.graphicsDir + self.fileSep + "qlearn_decodedMoves.png"

        self.trainedCells = []
        self.selfMoves = []

        self.TrainingImageFound = False
        self.TrainingGraphImage = None

        self.QLearnTrainingImageFound = False
        self.QLearnTrainingGraphImage = None

        self.SelfMovesMade = 0
コード例 #2
0
def getColorFormImage(fn):
    f = jf.File(fn) 
    img =  IIO.read(f)
    x = img.getWidth()/2
    y = img.getHeight()/2
    #print "gk "+str(x) +str(y)
    return JColor(img.getRGB(x,y))
コード例 #3
0
ファイル: mcSimulate3.py プロジェクト: jrminter/dtsa2scripts
def backscatter(mat, e0, nTraj=100000, buildSample=buildBulk, params={}):
   """backscatter(mat, e0, nTraj=100000, buildSample=buildBulk)
   Simulate backscatter from the specified material at the specified beam energy."""
   defOut = (dtsa2.DefaultOutput if dtsa2.DefaultOutput else dtsa2.reportPath())
   monte = nm.MonteCarloSS()
   monte.setBeamEnergy(epq.ToSI.keV(e0))
   p = params.copy()
   p["Material"] = mat
   buildSample(monte, (0.0, 0.0, 0.0), p)
   bs0 = nm.BackscatterStats(monte, 100)
   monte.addActionListener(bs0)
   ann = nm.AnnularDetector(1.0e-3, 10, (0.0, 0.0, -1.0e-3), (0.0, 0.0, 1.0)) 
   monte.addActionListener(ann)
   monte.runMultipleTrajectories(nTraj)
   tmpFile = jio.File.createTempFile("Backscatter", ".csv", jio.File(defOut))
   print u"Results -> %s" % tmpFile
   fos = jio.FileOutputStream(tmpFile)
   try:
      osw = jio.OutputStreamWriter(fos)
      osw.append("Parameters:\n")
      osw.append("E0\t%g keV\n" % e0)
      for k, v in p.iteritems():
         osw.append("%s\t%s\n" % (k, v))
      ann.dump(osw)
      osw.flush()
      bs0.dump(fos)
   finally:    
      fos.close()
   return (bs0.backscatterFraction(), bs0.forwardscatterFraction())
コード例 #4
0
 def save(self, path):
     rectangle = self.getScreenDataArea()
     w = rectangle.getWidth()
     h = rectangle.getHeight()
     org.jfree.chart.ChartUtilities.saveChartAsPNG(io.File(path),
                                                   self.getChart(), int(w),
                                                   int(h))
コード例 #5
0
ファイル: JESProgram.py プロジェクト: apple1986/mediacomp-jes
    def setHelpArray(self):
        try:
            myFile = io.File(JESConstants.JESHELP)

            arrayOfFiles = myFile.listFiles()
            arrayOfNames = []

            for x in arrayOfFiles:
                arrayOfNames.append(x.toURL())
            stringNames = []
            for x in arrayOfNames:
                stringNames.append(x.toString())

            # for name in stringNames:
            #     # if (name.find('.DS_Store') != -1):
            #     if(name.startswith('.')):
            #         stringNames.remove(name)

            stringNames = [
                name for name in stringNames
                if not helpfile_strip(name).startswith(".")
            ]
            stringNames.sort(helpfile_cmp)

            # l = stringNames[1]
            # stringNames.remove(l)
            # stringNames.insert(10, l)
            self.gui.SetHelpFiles(stringNames)
        except Exception, e:
            print "ERROR opening help files"
            print e
コード例 #6
0
ファイル: demo2.py プロジェクト: ke0m/Senior_Design
    def initUI(self):

        self.panel = JPanel(size=(50, 50))

        self.panel.setLayout(FlowLayout())
        self.panel.setToolTipText("GPU Demo")

        self.textfield1 = JTextField('Smoothing Parameter', 15)
        self.panel.add(self.textfield1)

        joclButton = JButton("JOCL", actionPerformed=self.onJocl)
        joclButton.setBounds(100, 500, 100, 30)
        joclButton.setToolTipText("JOCL Button")
        self.panel.add(joclButton)

        javaButton = JButton("Java", actionPerformed=self.onJava)
        javaButton.setBounds(100, 500, 100, 30)
        javaButton.setToolTipText("Java Button")
        self.panel.add(javaButton)

        qButton = JButton("Quit", actionPerformed=self.onQuit)
        qButton.setBounds(200, 500, 80, 30)
        qButton.setToolTipText("Quit Button")
        self.panel.add(qButton)
        newImage = ImageIO.read(io.File("input.png"))
        resizedImage = newImage.getScaledInstance(600, 600, 10)
        newIcon = ImageIcon(resizedImage)
        label1 = JLabel("Input Image", newIcon, JLabel.CENTER)

        label1.setVerticalTextPosition(JLabel.TOP)
        label1.setHorizontalTextPosition(JLabel.RIGHT)
        label1.setSize(10, 10)
        label1.setBackground(Color.orange)
        self.panel.add(label1)

        self.getContentPane().add(self.panel)

        self.clockLabel = JLabel()
        self.clockLabel.setSize(1, 1)
        self.clockLabel.setBackground(Color.orange)

        self.clockLabel.setVerticalTextPosition(JLabel.BOTTOM)
        self.clockLabel.setHorizontalTextPosition(JLabel.LEFT)

        myClockFont = Font("Serif", Font.PLAIN, 50)
        self.clockLabel.setFont(myClockFont)

        self.panel.add(self.clockLabel)

        self.setTitle("GPU Demo")
        self.setSize(1200, 600)
        self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
        self.setLocationRelativeTo(None)
        self.setVisible(True)
コード例 #7
0
    def __init__(self, frame):

        ld = io.File(g.app.loadDir)
        ijcl.addToSearchPath(ld)
        ijcl.beginLoading()
        self.font = frame.top.getFont()
        self.executor = java.util.concurrent.Executors.newCachedThreadPool()
        self.queue = java.util.concurrent.LinkedBlockingQueue()
        self.menu_changer = self.MenuChanger(self.queue)
        self.names_and_commands = {}
        self.keystrokes_and_actions = {}
        leoMenu.leoMenu.__init__(self, frame)
コード例 #8
0
    def save(self, path):
        img = com.mxgraph.util.mxCellRenderer.createBufferedImage(self.graph, None, 1, awt.Color.WHITE, False, None)
        imageio.ImageIO.write(img, "png", io.File(path))


    

#            stylesheet = graph.getStylesheet()
#        style = {}
#        style[mxConstants.STYLE_SHAPE] = mxConstants.SHAPE_ELLIPSE
##        style[mxConstants.STYLE_OPACITY] = 0
##style.put(mxConstants.STYLE_FONTCOLOR, "#774400");
#        stylesheet.putCellStyle("ROUNDED", style)
コード例 #9
0
ファイル: util.py プロジェクト: ecor/geoscript-py
def toFile(o):
    """
  Transforms an object to a File if possible. This method can take a file, 
  string, uri, or url object.
  """
    if isinstance(o, (io.File, file)):
        return o
    elif isinstance(o, net.URI):
        return toFile(o.toURL())
    elif isinstance(o, net.URL):
        return toFile(o.getFile())
    elif isinstance(o, (str, unicode)):
        return io.File(o)
コード例 #10
0
def reportAnnularDetector(ann, header, fileName):
    defOut = (d2.DefaultOutput if d2.DefaultOutput else d2.reportPath())
    tmpFile = jio.File(defOut, filename)
    fos = jio.FileOutputStream(tmpFile)
    try:
        osw = jio.OutputStreamWriter(fos)
        if header:
            osw.append(header + "\n")
        ann.dump(osw)
        osw.flush()
    finally:
        fos.close()
    print "Annular Detector output written to " + tmpFile
コード例 #11
0
 def chooseFile(self, save = True, filter = None):
     rv = None
     chooser = swing.JFileChooser(self.cwd)
     if self.cwd != None:
         curfile = io.File(self.cwd)
         if curfile.isFile():
             chooser.setSelectedFile(curfile)
     fun = {True: chooser.showSaveDialog, False: chooser.showOpenDialog}[save]
     if fun(self) == swing.JFileChooser.APPROVE_OPTION:
         rv = chooser.getSelectedFile()
         if rv:
             rv = rv.getAbsolutePath()
             self.cwd = rv
     return rv
コード例 #12
0
def reclassify(zepFile, ruleSet):
    """reclassify(zepFile, ruleSet)
Arguments:
    zepFile: Is a string containing the full path of the Zeppelin file
    ruleSet: An instance of a class that implements graf.IRuleSet"""
    z = graf.Zeppelin(zepFile)
    z.evaluateClass(ruleSet)
    for i in range(0,100):
        newName=zepFile.replace(".hdz","_%s.hdz" % ( str(ruleSet), ) )
        if not jio.File(newName).exists():
            print "Writing resulting data set to "+newName
            z.write(newName)
            break
    return z
コード例 #13
0
    def browser(self, n):

        types = [("C/C++ files", "*.c"), ("C/C++ files", "*.cpp"),
                 ("C/C++ files", "*.h"), ("C/C++ files", "*.hpp"),
                 ("Java files", "*.java"), ("Pascal files", "*.pas"),
                 ("Python files", "*.py"), ("Text files", "*.txt"),
                 ("All files", "*")]

        import java.io as io
        f = io.File("tmp")
        parent = f.getParentFile()
        f = None

        fc = swing.JFileChooser(parent)
        fc.setDialogTitle("Choose compare file" + n)

        haveseen = {}
        for z in types:
            if z[0] in haveseen:
                haveseen[z[0]].extend(z[1])
            else:
                bf = self.brwsfilter(z)
                fc.addChoosableFileFilter(bf)
                haveseen[z[0]] = bf

        result = fc.showOpenDialog(self.top)
        if result == fc.APPROVE_OPTION:
            fileName = fc.getSelectedFile().getAbsolutePath()
        else:
            fileName = None

        #fileName = tkFileDialog.askopenfilename(
        #    title="Choose compare file" + n,
        #    filetypes=types,
        #    defaultextension=".txt")

        if fileName and len(fileName) > 0:
            # The dialog also warns about this, so this may never happen.
            if not g.os_path_exists(fileName):
                self.show("not found: " + fileName)
                fileName = None
        else:
            fileName = None

        return fileName
コード例 #14
0
ファイル: util.py プロジェクト: ecor/geoscript-py
def toURL(o):
    """
  Transforms an object to a URL if possible. This method can take a file, 
  string, uri, or url object.
  """

    if isinstance(o, net.URL):
        return o
    elif isinstance(o, (net.URI, io.File)):
        return o.toURL()
    elif isinstance(o, (str, unicode)):
        try:
            return net.URL(o)
        except net.MalformedURLException:
            try:
                return net.URL('file:%s' % o)
            except net.MalformedURLException:
                return io.File(o).toURL()
コード例 #15
0
ファイル: PathVFS.py プロジェクト: varialus/jython-legacy
 def add_vfs(self,fname):
     if fname == '':
         if not self.once.has_key(''):
             self.once['']=1
             self.vfs.append(DirVFS(''));
         return        
     file=io.File(fname);
     canon = file.canonicalPath
     if not self.once.has_key(canon):
         self.once[canon]=1
         try:
             if file.directory:
                 self.vfs.append(DirVFS(fname));
             else:
                 if file.exists and (fname.endswith('.jar') or fname.endswith('.zip')):
                     self.vfs.append(JarVFS(fname))
         except:
             pass
コード例 #16
0
def loadJar(jarFile):
    '''load a jar at runtime using the system Classloader (needed for JDBC)

    adapted from http://forum.java.sun.com/thread.jspa?threadID=300557
    Author: Steve (SG) Langer Jan 2007 translated the above Java to Jython
    Reference: https://wiki.python.org/jython/JythonMonthly/Articles/January2007/3
    Author: [email protected] simplified and updated for jython-2.5.3b3+

    >>> loadJar('jtds-1.3.1.jar')
    >>> from java import lang, sql
    >>> lang.Class.forName('net.sourceforge.jtds.jdbc.Driver')
    <type 'net.sourceforge.jtds.jdbc.Driver'>
    >>> sql.DriverManager.getDriver('jdbc:jtds://server')
    jTDS 1.3.1
    '''
    from java import io, net, lang
    u = io.File(jarFile).toURL() if type(jarFile) <> net.URL else jarFile
    m = net.URLClassLoader.getDeclaredMethod('addURL', [net.URL])
    m.accessible = 1
    m.invoke(lang.ClassLoader.getSystemClassLoader(), [u])
コード例 #17
0
    def __init__(self):

        self.cached_pages = {}
        self.seen_elements = []
        self.entered = []
        dbf = jparse.DocumentBuilderFactory.newInstance()
        dbf.setValidating(0)
        dbf.setIgnoringComments(1)
        self.documentBuilder = dbf.newDocumentBuilder()
        self.documentBuilder.setEntityResolver(DoNothingEntityResolver())
        self.htmlPane = swing.JEditorPane("text/html",
                                          "",
                                          editable=0,
                                          hyperlinkUpdate=self.followHyperlink)
        self.jsp = swing.JScrollPane(self.htmlPane)
        self.html_dir = g.os_path_join(g.app.loadDir, "..", "doc", "html",
                                       "leo_TOC.html")
        self.fakeDoc = html.HTMLDocument()
        ifile = io.File(self.html_dir)
        self.homeUrl = url = ifile.getCanonicalFile().toURL()
        self.setPage(url)
コード例 #18
0
    def onBrowse3(self):  # Get the name of the output file.

        #fileName = tkFileDialog.asksaveasfilename(
        #    initialfile = self.defaultOutputFileName,
        #    title="Set output file",
        #    filetypes=[("Text files", "*.txt")],
        #    defaultextension=".txt")
        import java.io as io
        f = io.File("tmp")
        parent = f.getParentFile()
        f = None

        fc = swing.JFileChooser(parent)
        result = fc.showSaveDialog(self.top)
        if result == fc.APPROVE_OPTION:
            fileName = fc.getSelectedFile().getAbsolutePath()
        else:
            fileName = None

        if fileName and len(fileName) > 0:
            self.defaultOutputFileName = fileName
            self.useOutputFileVar.set(1)  # The user will expect this.
            e = self.browseEntries[2]
            e.setText(fileName)
コード例 #19
0
    def initUI(self):

        panel = JPanel(size=(50,50))
        

        panel.setLayout(BorderLayout( ))
        panel.setToolTipText("A Panel container")

        joclButton = JButton("JOCL", actionPerformed=self.onJOCL)
        joclButton.setBounds(100, 500, 100, 30)
        joclButton.setToolTipText("JOCL Button")
        panel.add(joclButton)

        qButton = JButton("Quit", actionPerformed=self.onQuit)
        qButton.setBounds(200, 500, 80, 30)
        qButton.setToolTipText("Quit Button")
        panel.add(qButton)
		
		
		
        newImage = ImageIO.read(io.File("input.png"))
        resizedImage =  newImage.getScaledInstance(500, 500,10)
        newIcon = ImageIcon(resizedImage)
        label1 = JLabel("Image and Text",newIcon, JLabel.	CENTER)

        label1.setVerticalTextPosition(JLabel.BOTTOM)
        label1.setHorizontalTextPosition(JLabel.CENTER)
        label1.setSize(10,10)
        panel.add(label1)
        
        self.getContentPane().add(panel)
        self.setTitle("GPU Demo")
        self.setSize(1200, 600)
        self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
        self.setLocationRelativeTo(None)
        self.setVisible(True)
コード例 #20
0
ファイル: jy_ImageViewer2.py プロジェクト: ke0m/Senior_Design
from
http://www.jython.org/downloads.html
to run this code on Windows you can use
Jython.bat jy_ImageViewer2.py
tested with jython2.7.2 by vegaseat 07jan2013
"""

from pawt import swing
from java import io
from javax import imageio


def view_image(image):
    # create a frame/window
    frame = swing.JFrame("Jython Image Viewer")
    #allows frame corner x to exit properly
    frame.defaultCloseOperation = swing.JFrame.EXIT_ON_CLOSE
    frame.visible = True
    #change to fit image size
    frame.setSize(1500, 1000)
    frame.getContentPane().add(swing.JLabel(swing.ImageIcon(image)))
    frame.show()


# get an image file you have available ...
image_filename = "input.png"
# load the image from the file
image = imageio.ImageIO.read(io.File(image_filename))
reimage = getScaledInstance(image.getIconWidth(), image.getIconHeight(), null)
view_image(reimage)
コード例 #21
0
 def open(self, id):
     f = io.File(self.pfx, id.replace('/', io.File.separator))
     if f.file:
         ##            print "path-open:",f # ?? dbg
         return io.BufferedInputStream(io.FileInputStream(f))
     return None
コード例 #22
0
        path = dirpath[ len( arg ): ]
        if path.startswith( "/jfreereport" ):
            for z in namelist:
                if z.endswith( ".jar" ):
                    self.addJar( "%s/%s" % ( dirpath, z ) )
                    
        
    
            


#@-node:zorcanda!.20051107123858:<<JFreeReportClassLoader>>
#@nl
try:
    jfcl = JFreeReportClassLoader()
    f = io.File( g.app.loadDir )
    pf = f.getParent()
    jf = io.File( pf, "jars" )
    jfcl.walkAndAdd( jf.getAbsolutePath() )

    def loadJFreeReport():
        rv = { "JFreeReportBoot": "org.jfree.report.JFreeReportBoot",
                "JFreeReport": "org.jfree.report.JFreeReport",
                "factory": "org.jfree.report.elementfactory.TextFieldElementFactory",
                "FloatDimension" : "org.jfree.ui.FloatDimension",
                "ElementAlignment" : "org.jfree.report.ElementAlignment",
                "PreviewFrame" : "org.jfree.report.modules.gui.base.PreviewFrame" }
                
        for z in rv.keys():
            clazz = jfcl.loadClass( rv[ z ] )
            jfcl.resolve( clazz )
コード例 #23
0
"""
Check comparing a java class to None.
"""

import support
from java import io
import sys

a = io.File("xx")

if a == None:
    pass
コード例 #24
0
def load(name):
    """Returns a BufferedImage object with the contents of the image at the file with the given name."""
    return imageio.ImageIO.read(io.File(name))
コード例 #25
0
    os.path.walk(path, clb2.walk, None)  #must find the jazzy-core.jar file...

    #we import the resources via this classloader because just adding the jar file to the sys.path is inadequate
    clb2.importClass("SpellCheckListener",
                     "com.swabunga.spell.event.SpellCheckListener")
    clb2.importClass("SpellChecker", "com.swabunga.spell.event.SpellChecker")
    clb2.importClass("SpellDictionaryHashMap",
                     "com.swabunga.spell.engine.SpellDictionaryHashMap")
    #clb2.importClass( "SpellDictionaryCachedDichoDisk", "com.swabunga.spell.engine.SpellDictionaryCachedDichoDisk" )
    clb2.importClass("StringWordTokenizer",
                     "com.swabunga.spell.event.StringWordTokenizer")

    proppath = g.os_path_join(
        g.app.loadDir, "..", "plugins", "spellingdicts",
        "which.txt")  #we start to determine which dictionary to use
    fis = io.FileInputStream(io.File(proppath))
    properties = util.Properties()
    properties.load(fis)
    fis.close()
    fis = None
    lfile = properties.getProperty("dict")
    dpath = g.os_path_join(g.app.loadDir, "..", "plugins", "spellingdicts",
                           lfile)
    dictionary = SpellDictionaryHashMap(io.File(dpath))

    import org.python.core.Py as Py  #now we descend into the Jython internals...
    sstate = Py.getSystemState()
    cloader = sstate.getClassLoader()
    sstate.setClassLoader(
        clb2
    )  #we do this so the JyLeoSpellChecker class can implement SpellCheckListener, otherwise it fails
コード例 #26
0
ファイル: mcSimulate3.py プロジェクト: jrminter/dtsa2scripts
def base(det, e0, withPoisson, nTraj, dose, sf, bf, name, buildSample, buildParams, xtraParams):
   """base(det, e0, withPoisson, nTraj, dose, sf, bf, name, buildSample, buildParams) represents \
   a generic mechanism for Monte Carlo simulation of x-ray spectra.  The argument buildSample \
   is a method buildSample(monte,origin,buildParams) taking an instance of MonteCarloSS, the \
   position of the origin and a dictionary of build parameters.  This method should construct \
   the sample geometry.  The other arguments are the detector, the beam energy (keV), whether \
   to add Poisson noise, the number of electron trajectories to simulate, whether to simulate \
   characteristic secondary fluorescence and Bremsstrahlung secondary fluorescence, the name \
   to assign to the resulting spectrum."""
   if e0 < 0.1:
       raise "The beam energy must be larger than 0.1 keV."
   if nTraj < 1:
       raise "The number of electron trajectories must be larger than or equal to 1."
   if dose <= 0.0:
       raise "The electron dose must be larger than zero."
   name = name.strip()
   if xtraParams.has_key("Postfix"):
      name = "%s - %s" % (name, xtraParams["Postfix"])
   # Place the sample at the optimal location for the detector
   origin = epq.SpectrumUtils.getSamplePosition(det.getProperties())
   # Create a simulator and initialize it
   monte = nm.MonteCarloSS()
   if xtraParams.has_key("Gun"):
      gun = xtraParams["Gun"]
      gun.setCenter([0.0, 0.0, -0.099])
      monte.setElectronGun(gun)
   if xtraParams.has_key("PosX"):
      beamX  = xtraParams["PosX"]
      beamY  = xtraParams["PosY"]
      beamZ  = xtraParams["PosZ"]
      beamNM = xtraParams["nmSize"]
      beam=nm.GaussianBeam(beamNM*1.0e-9)
      beam.setCenter([beamX, beamY, beamZ]) 
      monte.setElectronGun(beam)
   chamber = monte.getChamber()
   if xtraParams.has_key("VP"):
       pathLength, gas = xtraParams["VP"]
       dim = 0.5 * nm.MonteCarloSS.ChamberRadius;
       dims = epu.Math2.plus(epu.Math2.v3(dim, dim, dim), epu.Math2.z3(2.0 * pathLength))
       pt = epu.Math2.plus(origin, epu.Math2.z3(0.5 * dim));
       shape = nm.MultiPlaneShape.createBlock(dims, pt, 0.0, 0.0, 0.0);
       msm = nm.BasicMaterialModel(gas);
       chamber = monte.addSubRegion(chamber, msm, shape);
   monte.setBeamEnergy(epq.ToSI.keV(e0))
   buildSample(monte, chamber, origin, buildParams)
   # Add event listeners to model characteristic radiation
   chXR = nm3.CharacteristicXRayGeneration3.create(monte)
   xrel = nm3.XRayTransport3.create(monte, det, chXR)
   brXR = nm3.BremsstrahlungXRayGeneration3.create(monte)
   brem = nm3.XRayTransport3.create(monte, det, brXR)
   chSF, brSF, bremFluor, charFluor  = None, None, None, None
   hasCharAcc = xtraParams.has_key('Characteristic Accumulator') and xtraParams['Characteristic Accumulator']
   if sf or hasCharAcc or xtraParams.has_key("Compton"):
      charFluor = nm3.FluorescenceXRayGeneration3.create(monte, chXR)
      if xtraParams.has_key("Compton"):
         charFluor.setIncludeCompton(True)
      chSF = nm3.XRayTransport3.create(monte, det, charFluor)
   hasBremFluorAcc = xtraParams.has_key('Brem Fluor Accumulator') and xtraParams['Brem Fluor Accumulator']
   if bf or hasBremFluorAcc:    
      bremFluor = nm3.FluorescenceXRayGeneration3.create(monte, brXR)       
      brSF = nm3.XRayTransport3.create(monte, det, bremFluor)
   hasTrans = xtraParams.has_key("Transitions")
   if hasTrans:
       if xtraParams.has_key("Emission Images"):
           eis = []
           dim = xtraParams["Emission Images"]
           for xrt in xtraParams["Transitions"]:
               size = xtraParams["Emission Size"]
               ei = nm3.EmissionImage3(size, size, xrt)
               xrel.addXRayListener(ei)
               if chSF:
                   chSF.addXRayListener(ei)
               if brSF:
                   brSF.addXRayListener(ei)
               ei.setXRange(origin[0] - 0.5 * dim, origin[0] + 0.5 * dim)
               ei.setYRange(origin[2] - 0.1 * dim, origin[2] + 0.9 * dim)
               eis.append(ei)
       if hasCharAcc:
           cxra = nm3.XRayAccumulator3(xtraParams["Transitions"], "Characteristic", dose * 1.0e-9)
           xrel.addXRayListener(cxra)
       hasCharFluorAcc = xtraParams.has_key('Char Fluor Accumulator') and xtraParams['Char Fluor Accumulator']
       if hasCharFluorAcc or chSF or sf:
           cfxra = nm3.XRayAccumulator3(xtraParams["Transitions"], "Characteristic Fluorescence", dose * 1.0e-9)
           chSF.addXRayListener(cfxra) 
       if hasBremFluorAcc or brSF or bf:
           bfxra = nm3.XRayAccumulator3(xtraParams["Transitions"], "Continuum Fluorescence", dose * 1.0e-9)
           brSF.addXRayListener(bfxra)
   contImgs = []
   if xtraParams.has_key('Continuum Images'):
       dim = xtraParams['Continuum Images']
       size = xtraParams['Continuum Size']
       energies = xtraParams['Continuum Energies']
       for eMin, eMax in energies:
           ci3 = nm3.ContinuumImage3(size, size, epq.ToSI.keV(eMin), epq.ToSI.keV(eMax))
           ci3.setXRange(origin[0] - 0.5 * dim, origin[0] + 0.5 * dim)
           ci3.setYRange(origin[2] - 0.1 * dim, origin[2] + 0.9 * dim)
           brem.addXRayListener(ci3)
           contImgs.append(ci3)
   doPRZ = xtraParams.has_key("PhiRhoZ")
   if doPRZ:
      depth = xtraParams["PhiRhoZ"]
      prz = nm3.PhiRhoZ3(xrel, origin[2] - 0.1 * depth, origin[2] + 1.1 * depth, 110)
      xrel.addXRayListener(prz)
   voxelated = xtraParams.has_key('Voxelated')
   vox = None
   if voxelated:
      dim = xtraParams['Voxelated']
      gen = xtraParams['GeneratedV']
      size = xtraParams['SizeV']
      vox = nm3.VoxelatedDetector((origin[0], origin[1], origin[2] - 0.1 * size), (size, size, size), (dim, dim, dim), gen)
      xrel.addXRayListener(vox)
   doTraj = xtraParams.has_key('Trajectories')
   if doTraj:
      dim = xtraParams['Trajectories']
      size = xtraParams['TrajSize']
      ti = nm.TrajectoryImage(size, size, dim)
      ti.setXRange(origin[0] - 0.5 * dim, origin[0] + 0.5 * dim)
      ti.setYRange(origin[2] - 0.1 * dim, origin[2] + 0.9 * dim)
      monte.addActionListener(ti)
   defOut = (dtsa2.DefaultOutput if dtsa2.DefaultOutput else dtsa2.reportPath())
   do = ("%s\\%s" % (xtraParams["Output"], dtsa2.normalizeFilename(name)) if xtraParams.has_key("Output") else "%s/%s" % (defOut, dtsa2.normalizeFilename(name)))
   do = do.replace("\\", "/")
   fdo = jio.File(do)
   fdo.mkdirs()
   doVRML = xtraParams.has_key('VRML')
   vrmlWr = None
   if doVRML:
      vrmlFile = jio.File.createTempFile("vrml", ".wrl", fdo)
      print "VRML in " + str(vrmlFile)
      vrmlWr = jio.FileWriter(vrmlFile)
      vrml = nm.TrajectoryVRML(monte, vrmlWr)
      vrml.setDisplayBackscatter(False)
      vrml.setDisplayXRayEvent(True)
      vrml.setMaxTrajectories(xtraParams['VRML'])
      vrml.setTrajectoryWidth(1.0e-9)
      vrml.setMaxRadius(1.0)
      vrml.setEmissive(True)
      vrml.addView("Y-Axis", epu.Math2.plus(origin, (0.0, 5.0e-6, 0.0)), origin)
      vrml.addView("Gun", epu.Math2.plus(origin, (0.0, 0.0, -5.0e-6)), origin)
      vrml.addView("X-Axis", epu.Math2.plus(origin, (-5.0e-6, 0.0, 0.0)), origin)
      vrml.renderSample()
      monte.addActionListener(vrml)
   scatter = None
   if xtraParams.has_key("Scatter"):
      scatter = nm.ScatterStats(epq.ToSI.eV(50.0))
      monte.addActionListener(scatter)
   # Reset the detector and run the electrons
   det.reset()
   monte.runMultipleTrajectories(nTraj)
   # Get the spectrum and assign properties
   spec = det.getSpectrum((dose * 1.0e-9) / (nTraj * epq.PhysicalConstants.ElectronCharge))
   props = spec.getProperties()
   props.setNumericProperty(epq.SpectrumProperties.LiveTime, dose)
   props.setNumericProperty(epq.SpectrumProperties.FaradayBegin, 1.0)
   props.setNumericProperty(epq.SpectrumProperties.BeamEnergy, e0)
   epq.SpectrumUtils.rename(spec, name)
   if withPoisson:
      spec = epq.SpectrumUtils.addNoiseToSpectrum(spec, 1.0)
   printAcc = xtraParams.has_key('Print Accumulators') and xtraParams['Print Accumulators']
   if printAcc:
      sw0 = jio.StringWriter()
      sw = jio.PrintWriter(sw0)
   if hasTrans or scatter:
      pw = None
      if hasCharAcc or (hasBremFluorAcc and bf) or (hasCharFluorAcc and sf) or scatter:
         jio.File(do).mkdirs()
         pw = jio.PrintWriter("%s/Intensity.csv" % do)
         pw.println(name)
      if hasCharAcc:
         pw.println("Characteristic") 
         cxra.dump(pw)
         if printAcc:
             sw.println("Characteristic") 
             cxra.dump(sw)
      if hasBremFluorAcc and brSF and bf:
         pw.println("Bremsstrahlung Fluorescence")
         bfxra.dump(pw)
         if printAcc:
             sw.println("Bremsstrahlung Fluorescence") 
             bfxra.dump(sw)
      if hasCharFluorAcc and chSF and sf:
         pw.println("Characteristic Fluorescence")
         cfxra.dump(pw)
         if printAcc:
             sw.println("Characteristic Fluorescence")
             cfxra.dump(sw)
      if printAcc:
          print sw0.toString()
          sw.close()
          sw0.close()
      if scatter:
         scatter.header(pw)
         scatter.dump(pw)
      if pw:
         pw.close()
      imgs = []
      if xtraParams.has_key("Emission Images"):
         nm3.EmissionImageBase.scaleEmissionImages(eis)
         print eis
         print do          
         nm3.EmissionImage3.dumpToFiles(eis, do)
         print u"Writing emission images to %s" % do
         imgs.extend(eis)
      if xtraParams.has_key("Continuum Images"):
         imgs.extend(contImgs)      
         nm3.EmissionImageBase.scaleEmissionImages(imgs)
         print contImgs
         print do          
         nm3.ContinuumImage3.dumpToFiles(contImgs, do)
         print u"Writing continuum images to %s" % do
   if doPRZ:
       jio.File(do).mkdirs()
       pw = jio.PrintWriter(u"%s/PhiRhoZ.csv" % do)
       prz.write(pw)
       pw.close()
       print u"Writing emission images to %s" % do
   if doTraj:
      ti.dumpToFile(do)
      print u"Writing trajectory images to %s" % do
   if vrmlWr:
       vrmlWr.close()
   if vox:
      jio.File(do).mkdirs()
      objs = list(vox.getAccumulatorObjects())
      xx = {}
      for obj in objs:
          iio.write(vox.createXZSum(400, obj), "png", jio.File(do, "Voxelated[XZ,Sum][%s].png" % obj))
          iio.write(vox.createXYSum(400, obj), "png", jio.File(do, "Voxelated[XY,Sum][%s].png" % obj))
          iio.write(vox.createXZView(400, obj), "png", jio.File(do, "Voxelated[XZ, Max][%s].png" % obj))
          iio.write(vox.createXYView(400, obj), "png", jio.File(do, "Voxelated[XY, Max][%s].png" % obj))
          vox.writeXZPlanar(400, obj, jio.File(do, "Voxilated[XZ,planar,%s].tif" % obj))
          vox.writeXYPlanar(400, obj, jio.File(do, "Voxilated[XY,planar,%s].tif" % obj))
          for f in (0.1, 0.5, 0.8, 0.9):
              iio.write(vox.createXZFraction(400, obj, f), "png", jio.File(do, "Voxelated[XZ,f=%g][%s].png" % (f, obj)))
          xx[obj] = vox.createRadialCDF(origin, obj)
      hdr = "Radius"
      for obj in objs:
          hdr = "%s\t%s" % (hdr, obj)
      print hdr
      first = xx[objs[0]]
      for i, (d, f) in enumerate(first):
          ln = "%g" % d
          for obj in objs:
              rcdf = xx[obj][i]
              ln = "%s\t%g" % (ln, rcdf[1])
          print ln
   #if bremFluor:
       #print "Stats[Scale] = %s" % bremFluor.getScaleStats()         
   return dtsa2.wrap(spec)
コード例 #27
0
    def paintComponent(self, g):

        core.DataViewComponent.paintComponent(self,
                                              g)  # call base class paint...

        cellBuffer = 20
        mazeBuffer = 30
        cellSize = 50
        cellSpacing = 2
        cellSpace = cellSize + cellSpacing

        #TraceOn = True

        # grab the current stored data for the time tick being shown
        paintData = self.data.get(start=self.view.current_tick, count=1)[0]

        # we only paint if one of these changes, walls, the base maze and the start/end do not change during the runs
        path = paintData["path"]

        RatX = paintData[
            'RatX']  # need to convert to int and round (can't display partial coordinates and jython drawimage calls below need explicit int's
        RatY = paintData['RatY']

        BestNextTrainingMoveX = paintData['BestNextTrainingMoveX']
        BestNextTrainingMoveY = paintData['BestNextTrainingMoveY']

        thinkingOfMoving_x = paintData["thinkingOfMoving_x"]
        thinkingOfMoving_y = paintData["thinkingOfMoving_y"]

        LeverRatPulled = paintData['LeverRatPulled']  # lever the rat pulls...

        # load rest of values, note these don't change but cannot be loaded in constructor (that I know of due to callbacks)
        mazeX = paintData['mazeX']
        mazeY = paintData['mazeY']

        sx = paintData['sx']
        sy = paintData['sy']

        ex = paintData['ex']
        ey = paintData['ey']

        self.oldXY = (-1, -1)

        cheeseLever = paintData['cheeseLever']  #the lever where the cheese is
        walls = paintData["walls"]
        CurrentPathNumber = paintData["CurrentPathNumber"]
        NumberOfPaths = paintData["NumberOfPaths"]
        CurrentNodeNumber = paintData["CurrentNodeNumber"]
        NumberOfNodes = paintData["NumberOfNodes"]
        TrainingOn = paintData["TrainingOn"]
        RandomLearning = paintData["RandomLearning"]
        mappingResults = paintData["MappingResults"]
        mappingResultsXY = [(x[0], x[1]) for x in mappingResults
                            ]  # just the XY coordinates for indexing

        # Background box...
        g.color = Color(0, 255, 255)  # light blue
        mazeMaxX = (cellSize * mazeX) + cellBuffer
        mazeMaxY = mazeY - (cellSize * mazeY) + cellBuffer

        # set size of the component on the screen, note cannot be minimized past this
        self.setSize(
            int(
                round(((cellSize * (mazeX)) + cellBuffer + (mazeBuffer * 2)),
                      0)),
            int(
                round(((cellSize * (mazeY + 5)) + cellBuffer +
                       (mazeBuffer * 2)) * 1.3, 0)))

        g.fill3DRect(0, 0,
                     ((cellSize + cellBuffer) * (mazeX + 1)) + mazeBuffer,
                     ((cellSize + cellBuffer) * (mazeY)) - 80, True)

        titleMsg = ''

        # Show learning status and progress...
        if TrainingOn:

            if not RandomLearning:
                titleMsg = 'Path Learning is ON, Processed %i of %i paths.' % (
                    CurrentPathNumber, NumberOfPaths)

            else:
                titleMsg = 'Random cell learning is ON, Processed %i of %i cells.' % (
                    CurrentNodeNumber, NumberOfNodes)

            self.trainedCells.append(
                path[0])  # todo change this to the start of path...

        else:
            # training is off...

            # plot the results of the training map...
            g.color = Color(255, 255, 255)  # white
            pwidth = ((cellSize + cellBuffer) * (mazeX + 1)) + mazeBuffer
            pheight = ((cellSize + cellBuffer) * (mazeY + 1)) + mazeBuffer

            if not (self.TrainingImageFound):  # try to locate it...
                if os.path.isfile(self.TrainingGraphFile):
                    # image found
                    mapResImage = io.File(self.TrainingGraphFile)
                    self.TrainingGraphImage = imageio.ImageIO.read(mapResImage)
                    self.TrainingImageFound = True

            if not (self.QLearnTrainingImageFound):  # try to locate it...
                if os.path.isfile(self.QLearnTrainingGraphFile):
                    # image found
                    QmapResImage = io.File(self.QLearnTrainingGraphFile)
                    self.QLearnTrainingGraphImage = imageio.ImageIO.read(
                        QmapResImage)
                    self.QLearnTrainingImageFound = True

            if (path[0]) != self.oldXY:
                self.SelfMovesMade += 1

                titleMsg = 'Rat navigating on it' 's own. %i moves made self navigating so far, %i moves in optimal path.' % (
                    self.SelfMovesMade, len(path) - 1)
                self.oldXY = (path[0]
                              )  # store (x,y) of the cell we have processed

                self.selfMoves.append(
                    path[0])  # todo change this to the start of path...
            else:
                # we have seen this move before, just repaint the screen
                pass

        g.color = Color(0, 0, 0)  # black
        g.drawString(titleMsg, 20, 50)  # put title over the maze...

        for x in range(mazeX):
            for y in range(mazeY):

                (xp, yp) = self.XYtoPix(x, y, mazeY)

                if (x, y) == (sx, sy):
                    # go/start cell
                    g.color = Color(50, 205, 50)  # green
                    g.fill3DRect(xp, yp, cellSize, cellSize, True)
                    (xpi, ypi) = self.XYtoPix(x, y, mazeY)
                    g.drawImage(self.goLightImage, xpi + 10, ypi + 10, self)

                if (x, y) == (ex, ey):
                    # color cheese end cell red to be background for other information icons...
                    g.color = Color(255, 0, 0)  # red color
                    g.fill3DRect(xp, yp, cellSize, cellSize, True)

                elif (x, y) in walls:
                    # fill in the walls
                    g.color = Color(0, 0, 255)  # dark blue
                    g.fill3DRect(xp, yp, cellSize, cellSize, True)

                else:
                    # check if this cell is in the mapping results and if so change the background color to show if it is a training error or not...

                    try:
                        ii = mappingResultsXY.index((x, y))
                    except:
                        ii = -1

                    if ii >= 0 and mappingResults[ii][2] != mappingResults[ii][
                            3]:
                        # this cell was not learned properly, show in red color
                        g.color = Color(255, 99,
                                        71)  # tomato / light-red color
                    else:
                        # empty cells where training was correct are just yellow...
                        g.color = Color(255, 255, 0)  # yellow

                    g.fill3DRect(xp, yp, cellSize, cellSize, True)

                # seperately show the best next move cell
                if (x, y) == (BestNextTrainingMoveX, BestNextTrainingMoveY):
                    # paint the best next move with a "B"
                    g.color = Color(0, 191, 255)  # medium blue color
                    g.fill3DRect(xp + 5, yp + 5, cellSize - 10, cellSize - 10,
                                 True)
                    g.color = Color(0, 0, 0)  # black
                    g.drawString("B", xp + cellSize / 2,
                                 yp + cellSize / 2)  # put B in centre...

                # seperately ontop of whatever is there overlay a bextNextMove marker
                if (x, y) in path:
                    # draw the path and then put the number on top...
                    pNum = [i for i, v in enumerate(path) if v == (x, y)]
                    pNumT = str(
                        pNum)  # if len(str(pNum))==1 else " " + str(pNum)
                    g.color = Color(124, 252, 0)  # light green
                    g.fill3DRect(
                        xp + 10, yp + 10, cellSize - 20, cellSize - 20, True
                    )  # make smaller to show background, shows visually if it thinks to move to a wall for example this way
                    g.color = Color(0, 0, 0)  # black
                    g.drawString(pNumT, xp + cellSize / 2 - 4, yp +
                                 cellSize / 2)  # put path number on top...

                # seperately show the thinking next cell...
                if (x, y) == (thinkingOfMoving_x, thinkingOfMoving_y):
                    # paint the next thinking of move with a "T"
                    #g.fill3DRect(xp + 5 , yp + 5, cellSize - 10, cellSize - 10, True)
                    #g.color = Color(0,0,0) # black
                    g.color = Color(255, 140, 0)  # light orange
                    g.drawString(
                        "TnM", xp + cellSize / 2 - 20, yp + cellSize / 2 +
                        20)  # put TnM = Thinking of Next Move in centre...

                if (x, y) == (ex, ey):
                    # cheese end cell sits on top of whatever is there...
                    (xpi, ypi) = self.XYtoPix(x, y, mazeY)
                    g.drawImage(self.cheeseLeversImage, xpi + 8, ypi + 10,
                                self)

                if (x, y) in self.trainedCells:
                    g.color = Color(0, 0, 0)  # black
                    g.drawString(
                        '.', xp + 4, yp + cellSize - 3
                    )  # put a dot at bottom of maze if the rat has trained on this cell already...

        # show the self movement history
        if not TrainingOn:
            smi = 1
            for m in self.selfMoves:
                g.color = Color(0, 0, 0)  # black
                (xpP, ypP) = self.XYtoPix(x, y, mazeY)
                g.drawString(
                    str(smi), xpP + 4, ypP + cellSize - 3
                )  # put a number at bottom of maze cell if the rat has moved this way already...
                smi += 1

        # paint the rat last so it ends up on top of whatever cell it is in
        if type(RatX) in (int, float) and type(RatY) in (
                int, float) and type(mazeY) in (int, float):
            self.writePrint(
                "Maze.DemoView: Rat moving to [%f, %f], pixel coordinates[%f,%f], maze(X,Y)=[%f, %f]."
                % (RatX, RatY, xpi, ypi, mazeY, mazeX))
            g.color = Color(255, 255, 255)  # white
            (xpi, ypi) = self.XYtoPix(RatX, RatY, mazeY)
            g.drawImage(self.ratImage, int(round(xpi + 7, 0)),
                        int(round(ypi + 7, 0)), None)

        else:
            self.writePrint(
                "Maze.DemoView: Type mismatch in parameters Rat(X,Y) types[%s, %s], pixel coordinates types[%s,%s], maze types(x,y)=[%s, %s]."
                % (type(RatX), type(RatY), type(xpi), type(ypi), type(mazeY),
                   type(mazeX)))

        # Paint legend at bottom of screen
        g.color = Color(0, 0, 0)  # black
        (xpi, ypi) = self.XYtoPix(0, 0, mazeY)

        g.drawString(
            "[x] shows the best next moves path the rat is/was trained on.",
            xpi + 20, ypi + 68)

        # Check for success: is the rat at the end cell and did it pull the right lever, if so success!
        if ((RatX, RatY) == (ex, ey)) and (LeverRatPulled == cheeseLever):
            g.color = Color(255, 255, 255)  # white
            g.fill3DRect(0, 0,
                         ((cellSize + cellBuffer) * (mazeX + 1)) + mazeBuffer,
                         ((cellSize + cellBuffer) * (mazeY + 1)) + mazeBuffer,
                         True)
            g.drawImage(self.RatWinsImage, 0, 0, self)

        # draw the graph of the results of training...
        if self.TrainingImageFound:
            g.drawImage(self.TrainingGraphImage, 30, pheight - 180, self)

        if self.QLearnTrainingImageFound:
            g.drawImage(self.QLearnTrainingGraphImage, 30, pheight - 20, self)
コード例 #28
0
#@+leo-ver=4-thin
#@+node:mork.20050127175441.1:@thin leoSwingMenu.py
"""Gui-independent menu handling for Leo."""

import leoGlobals as g
import java.io as io
import org.leo.shell.IsolatedJythonClassLoader as ijcl
ld = io.File(g.app.loadDir)
ijcl.addToSearchPath(ld)
ijcl.beginLoading()

import string
import sys
import leoMenu
import java
import java.awt as awt
import java.awt.event as aevent
import javax.swing as swing
import javax.swing.event as sevent
import javax.swing.tree as stree
import javax.swing.border as sborder
import java.lang
import pdb
from utilities.DefCallable import DefCallable
False = 0
True = 1


#@+others
#@+node:mork.20050127175441.2:class leoSwingMenu
class leoSwingMenu(leoMenu.leoMenu):
コード例 #29
0
ファイル: JESProgram.py プロジェクト: apple1986/mediacomp-jes
    def __init__(self):
        #"@sig public JESProgram()"
        #swing.UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
        #        self.userExperience = JESConfig.getInstance().getStringProperty(JESConfig.CONFIG_MODE);
        #        self.gutterOn = JESConfig.getInstance().getBooleanProperty(JESConfig.CONFIG_GUTTER);
        #        self.blockBoxOff = JESConfig.getInstance().getBooleanProperty(JESConfig.CONFIG_BLOCK);
        #        self.autoSaveOnRun = JESConfig.getInstance().getBooleanProperty(JESConfig.CONFIG_AUTOSAVEONRUN);
        #        self.backupSave = JESConfig.getInstance().getBooleanProperty(JESConfig.CONFIG_BACKUPSAVE);
        #        self.wrapPixelValues = JESConfig.getInstance().getBooleanProperty(JESConfig.CONFIG_WRAPPIXELVALUES);
        #        self.userFont = JESConfig.getInstance().getIntegerProperty(JESConfig.CONFIG_FONT);
        #        self.showTurnin = JESConfig.getInstance().getBooleanProperty(JESConfig.CONFIG_SHOWTURNIN);
        #        self.skin = JESConfig.getInstance().getStringProperty(JESConfig.CONFIG_SKIN);
        #        self.webDefinitions = JESConfig.getInstance().getStringProperty(JESConfig.CONFIG_WEB_TURNIN);
        #        self.mediaFolder = JESConfig.getInstance().getStringProperty(JESConfig.CONFIG_MEDIAPATH);

        self.logBuffer = JESLogBuffer.JESLogBuffer(self)
        #        self.logBuffer.saveBoolean = JESConfig.getInstance().getBooleanProperty(JESConfig.CONFIG_LOGBUFFER);

        # let's just read the config file once, and if
        # it's no there, we'll handle it right now.
        # self.preCheckForConfigFile()
        # self.getSettingsLater = 0
        # self.loadConfigFile()

        self.textForCommandWindow = ''
        self.aboutWindow = None
        self.introWindow = None

        self.gui = JESUI.JESUI(self)
        self.filename = ' '
        self.settingsFileName = ''
        self.interpreter = JESInterpreter.JESInterpreter(self)
        # a gross hack?, see JESUI.py on why it's commentted out there
        self.interpreter.debugger.watcher.setMinimumSize(
            awt.Dimension(500, 400))
        self.interpreter.debugger.watcher.setPreferredSize(
            awt.Dimension(600, 400))

        self.gui.windowSetting(None)

        self.varsToHighlight = self.interpreter.getVarsToHighlight()

        self.chooser = JESFileChooser.JESFileChooser()
        self.defaultPath = io.File(JESConfig.getInstance().getStringProperty(
            JESConfig.CONFIG_MEDIAPATH))
        self.setHelpArray()
        #self.loadSuccess(), 5/15/09 Dorn: removed as unnecessary and breaks due to needed code in loadSuccess for input

        self.gui.changeSkin(JESConfig.getInstance().getStringProperty(
            JESConfig.CONFIG_SKIN))
        self.gui.show()

        if JESConfig.getInstance().getBooleanProperty(JESConfig.CONFIG_BLOCK):
            self.gui.editor.removeBox()
        else:
            self.gui.editor.addBox()

        if JESConfig.getInstance().getBooleanProperty(JESConfig.CONFIG_GUTTER):
            self.gui.turnOnGutter()
        else:
            self.gui.turnOffGutter()

        # self.checkForConfigFile()
        ## do these once we're started...

        # later is now!
        #if self.getSettingsLater:
        #self.openSettingsGUI()
        #self.openIntroductionWindow()

        #Show introduction window if settings could not be loaded (Either new JES user or bad write permissions)
        if not JESConfig.getInstance().isConfigLoaded():
            self.openIntroductionWindow()
コード例 #30
0
 def save(self, path):
     format = path.rsplit('.', 1)[-1]
     img = com.mxgraph.util.mxCellRenderer.createBufferedImage(
         self.graph, None, 1, awt.Color.WHITE, False, None)
     imageio.ImageIO.write(img, format, io.File(path))