def __initialize(self):
     lookup = Lookup.getDefault().lookup
     self.lookup=lookup
     pc =ProjectController(lookup)
     pc.newProject()
     workspace = pc.getCurrentWorkspace()
     self.workspace=workspace
     graph_model = GraphController(lookup).getGraphModel()
     logging.info(graph_model)
     self.graph_model=graph_model
     self.preview_model = PreviewController(lookup).getModel()
     logging.info(self.preview_model)
     import_controller = ImportController(lookup)
     logging.info(import_controller)
     self.import_controller=import_controller
     filter_controller = FilterController(lookup)
     logging.info(filter_controller)
     appearance_controller = AppearanceController(lookup)
     logging.info(appearance_controller)
     appearance_model = appearance_controller.getModel()
     logging.info(appearance_model)
     ge = GraphicsEnvironment.getLocalGraphicsEnvironment()
     for f in ge.getAllFonts():
         n=f.getName()
         if n=="Yu Gothic UI Regular":
             self.font=f
示例#2
0
文件: font.py 项目: jggatc/pyj2d
def get_fonts():
    """
    **pyj2d.font.get_fonts**
    
    Return fonts available in JVM.
    """
    return [''.join([c for c in f if c.isalnum()]).lower() for f in GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames()]
示例#3
0
    def run(self):
        frame = JFrame('Available Fonts',
                       defaultCloseOperation=JFrame.EXIT_ON_CLOSE)

        #-----------------------------------------------------------------------
        # First, we a local graphics environment (LGE) instance.  Then, we call
        # its getAvailableFontFamilyNames() method to obtain the list of all
        # available font names.
        #-----------------------------------------------------------------------
        lge = GraphicsEnvironment.getLocalGraphicsEnvironment()
        fontNames = lge.getAvailableFontFamilyNames()

        #-----------------------------------------------------------------------
        # The JTextArea will be used to hold the names of the available fonts.
        # Unfortunately, we don't know, for certain, how many font names are
        # present.  So, we need to have the JTextArea be within a JScrollPane,
        # "just in case" too many names exist for us to display at one time. ;-)
        #-----------------------------------------------------------------------
        frame.add(
            JScrollPane(
                JTextArea('\n'.join(fontNames), editable=0, rows=8,
                          columns=32)))

        frame.pack()
        frame.setVisible(1)
示例#4
0
def get_fonts():
    """
    **pyj2d.font.get_fonts**
    
    Return fonts available in JVM.
    """
    GraphicsEnv = GraphicsEnvironment.getLocalGraphicsEnvironment()
    return GraphicsEnv.getAvailableFontFamilyNames()
示例#5
0
文件: font.py 项目: bendmorris/pyj2d
def get_fonts():
    """
    **pyj2d.font.get_fonts**
    
    Return fonts available in JVM.
    """
    GraphicsEnv = GraphicsEnvironment.getLocalGraphicsEnvironment()
    return GraphicsEnv.getAvailableFontFamilyNames()
def _loadFontsFromJar():
    gEnv = GraphicsEnvironment.getLocalGraphicsEnvironment()

    for fontName in _jarFontNames:
        stream = Label.getResourceAsStream('/' + fontName)
        if stream is None:
            print 'Warning: could not load font {0} from JAR'.format(fontName)
        else:
            font = Font.createFont(Font.TRUETYPE_FONT, stream)
            gEnv.registerFont(font)
示例#7
0
def get_fonts():
    """
    **pyj2d.font.get_fonts**
    
    Return fonts available in JVM.
    """
    return [
        ''.join([c for c in f if c.isalnum()]).lower()
        for f in GraphicsEnvironment.getLocalGraphicsEnvironment().
        getAvailableFontFamilyNames()
    ]
示例#8
0
 def run(self):
     d = 0
     LGE = GraphicsEnvironment.getLocalGraphicsEnvironment()
     for GD in LGE.getScreenDevices():  # foreach ScreenDevice...
         CO = GD.getDefaultConfiguration()  # Configuration object
         for GC in GD.getConfigurations():  # GraphicConfiguration
             b = GC.getBounds()  # virtual bounds
             frame = JFrame(
                 'Screen: %d' % d,  # d == Device # 0..N
                 CO,
                 size=(int(b.getWidth()) >> 1, int(b.getHeight()) >> 3),
                 defaultCloseOperation=JFrame.EXIT_ON_CLOSE)
             d += 1
             frame.add(JLabel( ` CO `))
             frame.setVisible(1)
def _loadFontsFromFileSystem():
    gEnv = GraphicsEnvironment.getLocalGraphicsEnvironment()

    for fontsDir in _localFontDirectories:
        for dirpath, dirnames, filenames in os.walk(fontsDir):
            for filename in filenames:
                if filename.lower().endswith('.ttf'):
                    p = os.path.join(dirpath, filename)

                    # Load the font from a file
                    fontFile = File(p)
                    if not fontFile.exists():
                        raise RuntimeError, 'Could not get font file for {0}'.format(
                            p)
                    else:
                        font = Font.createFont(Font.TRUETYPE_FONT, fontFile)
                        gEnv.registerFont(font)
示例#10
0
 def run(self):
     d = 0
     LGE = GraphicsEnvironment.getLocalGraphicsEnvironment()
     for GD in LGE.getScreenDevices():  # foreach ScreenDevice...
         for GC in GD.getConfigurations():  # GraphicConfiguration
             b = GC.getBounds()  # virtual bounds
             w = int(b.getWidth()) >> 1  # 1/2 screen width
             h = int(b.getHeight()) >> 3  # 1/8 screen height
             x = int((int(b.getWidth() - w) >> 1) + b.getX())
             y = int((int(b.getHeight() - h) >> 1) + b.getY())
             frame = JFrame(
                 'Screen: %d' % d,  # d == Device # 0..N
                 bounds=(x, y, w, h),
                 defaultCloseOperation=JFrame.EXIT_ON_CLOSE)
             d += 1
             frame.add(JLabel( ` GC `))
             frame.setVisible(1)
def autoset_zoom(imp):
	"""set the zoom of the current imageplus to give a reasonable window size,  based on reasonable guess at screen resolution"""
	h = imp.getHeight();
	w = imp.getWidth();
	try:
		gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode();
		screen_h = gd.getHeight();
		screen_w = gd.getWidth();
	except:
		screen_h = 1080;
		screen_w = 1920;
	zy = 100* math.floor(screen_h / (2 * h));
	zx = 100* math.floor(screen_w / (2 * w));
	zoom_factor = min([zx, zy]);
	IJ.run("Set... ", "zoom=" + str(zoom_factor) + 
						" x=" + str(math.floor(w/2)) + 
						" y=" + str(math.floor(h/2)));
	IJ.run("Scale to Fit", "");
示例#12
0
文件: fijipytools.py 项目: soyers/OAD
    def analyzeParticles(imp,
                         minsize,
                         maxsize,
                         mincirc,
                         maxcirc,
                         #filename='Test.czi',
                         addROIManager=False,
                         #headless=False,
                         exclude=True):

        if GraphicsEnvironment.isHeadless():
            print('Headless Mode detected. Do not use ROI Manager.')
            addROIManager = False

        if addROIManager:

            # get the ROI manager instance
            rm = RoiManager.getInstance()
            if rm is None:
                rm = RoiManager()
            rm.runCommand("Associate", "true")

            if not exclude:
                options = PA.SHOW_ROI_MASKS \
                    + PA.SHOW_RESULTS \
                    + PA.DISPLAY_SUMMARY \
                    + PA.ADD_TO_MANAGER \
                    + PA.ADD_TO_OVERLAY \

            if exclude:
                options = PA.SHOW_ROI_MASKS \
                    + PA.SHOW_RESULTS \
                    + PA.DISPLAY_SUMMARY \
                    + PA.ADD_TO_MANAGER \
                    + PA.ADD_TO_OVERLAY \
                    + PA.EXCLUDE_EDGE_PARTICLES

        if not addROIManager:

            if not exclude:
                options = PA.SHOW_ROI_MASKS \
                    + PA.SHOW_RESULTS \
                    + PA.DISPLAY_SUMMARY \
                    + PA.ADD_TO_OVERLAY \

            if exclude:
                options = PA.SHOW_ROI_MASKS \
                    + PA.SHOW_RESULTS \
                    + PA.DISPLAY_SUMMARY \
                    + PA.ADD_TO_OVERLAY \
                    + PA.EXCLUDE_EDGE_PARTICLES

        measurements = PA.STACK_POSITION \
            + PA.LABELS \
            + PA.AREA \
            + PA.RECT \
            + PA.PERIMETER \
            + PA.SLICE \
            + PA.SHAPE_DESCRIPTORS \
            + PA.CENTER_OF_MASS \
            + PA.CENTROID

        results = ResultsTable()
        p = PA(options, measurements, results, minsize, maxsize, mincirc, maxcirc)
        p.setHideOutputImage(True)
        particlestack = ImageStack(imp.getWidth(), imp.getHeight())

        for i in range(imp.getStackSize()):
            imp.setSliceWithoutUpdate(i + 1)
            ip = imp.getProcessor()
            # convert to a mask for the particle analyzer
            ip.invert()
            # do the particle analysis
            p.analyze(imp, ip)
            mmap = p.getOutputImage()
            # add the slide to the full stack
            particlestack.addSlice(mmap.getProcessor())

        return particlestack, results
示例#13
0
"""
"""
Copyright 2010 Jarl Haggerty

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
       
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""

from profelis import frame
from java.awt import GraphicsEnvironment

if __name__ == "__main__":
    frame = frame.ProfelisFrame()
    displayMode = GraphicsEnvironment.getLocalGraphicsEnvironment(
    ).getDefaultScreenDevice().getDisplayMode()
    frame.setSize(displayMode.getWidth() / 2, displayMode.getHeight() / 2)
    frame.setLocationRelativeTo(None)
    frame.setVisible(True)

    while frame.running:
        pass
示例#14
0
from BritefuryJ.Pres.Primitive import Primitive, Label, Spacer, Blank, Bin, Row, Column, FlowGrid
from BritefuryJ.Pres.RichText import RichText, TitleBar, Heading1, NormalText, Body, Page
from BritefuryJ.Pres.UI import UI, Section, SectionHeading1
from BritefuryJ.StyleSheet import StyleSheet, StyleValues
from BritefuryJ.LSpace.Interactor import PushElementInteractor
from BritefuryJ.LSpace.Input import Modifier

from BritefuryJ.Live import LiveValue, LiveFunction

from Britefury.Config.UserConfig import loadUserConfig, saveUserConfig
from Britefury.Config import Configuration
from Britefury.Config.ConfigurationPage import ConfigurationPage

# Font chooser

_ge = GraphicsEnvironment.getLocalGraphicsEnvironment()
_fontNames = sorted([font.name for font in _ge.allFonts])

_nameStyle = StyleSheet.style(Primitive.fontSize(10),
                              Primitive.foreground(Color(0.45, 0.45, 0.45)))
_hoverStyle = StyleSheet.style(
    Primitive.hoverBackground(
        FilledOutlinePainter(Color(0.95, 0.95, 0.95), Color(0.65, 0.65,
                                                            0.65))))
_headerNameStyle = StyleSheet.style(Primitive.fontItalic(True))


def _fontSample(fontName, sampleFn):
    sample = sampleFn(fontName)
    name = Label(fontName)
    return _hoverStyle(
示例#15
0
def getScreenSize():
    from java.awt import GraphicsEnvironment
    gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice()
    width = gd.getDisplayMode().getWidth()
    height = gd.getDisplayMode().getHeight()
    return width, height
示例#16
0
Copyright 2010 Jarl Haggerty

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
       
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""

from profelis import frame
from java.awt import GraphicsEnvironment

if __name__ == "__main__":
  frame = frame.ProfelisFrame()
  displayMode = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode()
  frame.setSize(displayMode.getWidth()/2, displayMode.getHeight()/2)
  frame.setLocationRelativeTo(None)
  frame.setVisible(True)

  

  while frame.running:
    pass