Esempio n. 1
0
    def draw(self):

        try:
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        except:
            pass

        self.images_dict = dict()
        self.canvas = Canvas(self.images_dict, None)
        self.canvas.addMouseListener(self)

        self.frame = JFrame("SimplePyzzle", visible = 1)
        self.frame.setMinimumSize(Dimension(300, 300))
        self.frame.setLocationRelativeTo(None)
        self.generate_button = JButton("Generate Puzzle")
        self.bottom_panel = JPanel()

        self.combo_box_list = [9, 16, 25, 36, 49]
        self.combo_box = JComboBox(self.combo_box_list)

        self.frame.contentPane.add(self.canvas, BorderLayout.CENTER)
        self.frame.contentPane.add(self.bottom_panel, BorderLayout.SOUTH)
        self.bottom_panel.add(self.generate_button, BorderLayout.EAST)
        self.bottom_panel.add(self.combo_box, BorderLayout.WEST)

        self.generate_button.actionPerformed = self.generate_board

        self.frame.setSize(500, 500)
        self.frame.defaultCloseOperation = JFrame.EXIT_ON_CLOSE;
        self.frame.pack()
def start_lconsole():
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())

    app.appInit()
    world = World()
    world.enableImportHooks()
    console = Console.Console('Console')
    world.setRootSubject(Console.ConsoleSubject(console, world.worldSubject))

    if len(sys.argv) > 1:
        if len(sys.argv) > 2:
            print 'Usage:'
            print '\t %s <python_script>' % (sys.argv[0], )
            sys.exit(-1)

        filename = sys.argv[1]
        if filename.lower().endswith('.py'):
            m = importPy2File(filename)
            console.executeModule(m, True)
        else:
            print 'Python script filename must end with .py'
            sys.exit(-1)

    def _onClose(wm):
        app.appShutdown()

    wm = WindowManager(world)
    wm.onCloseLastWindow = _onClose

    wm.showRootWindow()
Esempio n. 3
0
def main():
    load('bookshelf.conf')
    if config('LOCALE') is not None and config('LOCALE') != '':
        Locale.setDefault(Locale(config('LOCALE')))
    from window import BookshelfView
    from logic import Bookshelf
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())
    view = BookshelfView(Bookshelf())
    screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    view.setLocation(screenSize.width/5,  screenSize.height/5)
    view.setVisible(1)
Esempio n. 4
0
    def __init__(self):

        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());


        size = Dimension(800, 800)
        self.setPreferredSize(size)

        screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        self.setLocation(screenSize.getSize().width/2 - size.width/2, 100)
        self.setTitle("bashED Terminal HQ EXTREME");

        self.setUndecorated(True)
        self.getRootPane().setOpaque(False)
        #self.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
        self.setBackground(Color(0,128,0, 198))


        #j = JDesktopPane()
        #j.setOpaque(False)
        self.setLayout(None)

        self.setIconImage(ImageIcon('bin/gui/media/' + "icon.png").getImage())




        mp = MainPanel()
        self.add(mp)
        mp.setBounds(0, 0, size.width, size.height)


        imageTest = ImageIcon('bin/gui/media/' + "image.png")
        imageTestLabel = JLabel(imageTest)
        self.add(imageTestLabel)
        imageTestLabel.setBounds(0, 0, size.width, size.height)
        #self.getContentPane().add(mp)

        #self.getContentPane().add(JLabel("Iglo"))

        bb = BorderFactory.createLineBorder(Color.BLACK, 5)
        bw1 = BorderFactory.createLineBorder(Color.WHITE, 1)
        bw2 = BorderFactory.createLineBorder(Color.WHITE, 1)

        mp.setBorder( BorderFactory.createCompoundBorder( bw1, BorderFactory.createCompoundBorder(bb, bw2) ))


        #make the window viewable
        self.defaultCloseOperation=JFrame.EXIT_ON_CLOSE
        self.pack()
        self.setVisible(True)
Esempio n. 5
0
    def __init__(self):

        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())

        size = Dimension(800, 800)
        self.setPreferredSize(size)

        screenSize = Toolkit.getDefaultToolkit().getScreenSize()
        self.setLocation(screenSize.getSize().width / 2 - size.width / 2, 100)
        self.setTitle("bashED Terminal HQ EXTREME")

        self.setUndecorated(True)
        self.getRootPane().setOpaque(False)
        #self.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
        self.setBackground(Color(0, 128, 0, 198))

        #j = JDesktopPane()
        #j.setOpaque(False)
        self.setLayout(None)

        self.setIconImage(ImageIcon('bin/gui/media/' + "icon.png").getImage())

        mp = MainPanel()
        self.add(mp)
        mp.setBounds(0, 0, size.width, size.height)

        imageTest = ImageIcon('bin/gui/media/' + "image.png")
        imageTestLabel = JLabel(imageTest)
        self.add(imageTestLabel)
        imageTestLabel.setBounds(0, 0, size.width, size.height)
        #self.getContentPane().add(mp)

        #self.getContentPane().add(JLabel("Iglo"))

        bb = BorderFactory.createLineBorder(Color.BLACK, 5)
        bw1 = BorderFactory.createLineBorder(Color.WHITE, 1)
        bw2 = BorderFactory.createLineBorder(Color.WHITE, 1)

        mp.setBorder(
            BorderFactory.createCompoundBorder(
                bw1, BorderFactory.createCompoundBorder(bb, bw2)))

        #make the window viewable
        self.defaultCloseOperation = JFrame.EXIT_ON_CLOSE
        self.pack()
        self.setVisible(True)
'''
Created on Aug 7, 2014
 @author Angel Daniel Munoz Gonzalez
 @email [email protected]
 @School Universidad Tecnologica de Ciudad Juarez
 
'''
from __future__ import with_statement
from com.ziclix.python.sql import zxJDBC
from com.ziclix.python import *
from javax.swing import JOptionPane, UIManager
import csv
import sys
_nimbus = 'com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel'
    
UIManager.setLookAndFeel(_nimbus)

_sentinel = object()
def next(it, default=_sentinel):
    '''
        Emulates The next() built in Function
    '''
    try:
        return it.next()
    except StopIteration:
        if default is _sentinel:
            raise
        return default
    
def TimeMismatchException():
    '''
Esempio n. 7
0
 def setNativeUI(cls):
     """ generated source for method setNativeUI """
     try:
         UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())
     except Exception as e:
         System.err.println("Unable to set native look and feel.")
Esempio n. 8
0
def start_larch():
	global world

	UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() )



	jarCustomLarchApp = []
	jarCustomPythonApp = [ False ]


	# Register a JAR entry handler so that we can pick up custom apps
	def _handle_larch_app(name, reader):
		buf = reader()
		jarCustomLarchApp.append( buf )

	def _handle_python_app(name, reader):
		jarCustomPythonApp[0] = True

	app_in_jar.registerJarEntryHandler( lambda name: name == 'app.larch', _handle_larch_app )
	app_in_jar.registerJarEntryHandler( lambda name: name == 'app.py'  or  name == 'app$py.class', _handle_python_app )



	# If Larch was started from a JAR, scan it
	if app_in_jar.startedFromJar():
		app_in_jar.scanLarchJar()


	app.appInit()
	world = World()
	world.enableImportHooks()

	if len( sys.argv ) > 1:
		if sys.argv[1] == '-app':
			if len( sys.argv ) < 3:
				print 'Usage:'
				print '\t{0} -app <app_name>'
				sys.exit()
			# Custom app
			importName = sys.argv[2]
			appModule = __import__( importName )

			components = importName.split( '.' )
			for comp in components[1:]:
				appModule = getattr( appModule, comp )

			appState = appModule.newAppState()
			world.setRootSubject( appModule.newAppStateSubject( world, appState ) )
		else:
			# Load a document
			filename = sys.argv[1]
			document = Document.readFile( world, filename )
			if document is None:
				print 'Could not load {0}'.format(filename)
				sys.exit()
			subject = document.newSubject( world.worldSubject, None, filename )
			world.setRootSubject( subject )
	else:
		if len( jarCustomLarchApp ) > 0:
			buf = jarCustomLarchApp[0]
			document = Document.readFromBytes( world, buf, 'app' )
			subject = document.newSubject( world.worldSubject, None, 'app' )
			world.setRootSubject( subject )
		elif jarCustomPythonApp[0]:
			import app as appModule
			appState = appModule.newAppState()
			world.setRootSubject( appModule.newAppStateSubject( world, appState ) )
		else:
			from LarchCore.MainApp import MainApp
			appState = MainApp.newAppState()
			world.setRootSubject( MainApp.newAppStateSubject( world, appState ) )



	def _onClose(wm):
		app.appShutdown()

	wm = WindowManager( world )
	wm.onCloseLastWindow = _onClose

	wm.showRootWindow()
Esempio n. 9
0
def run(scene, w=512, h=512, aa=1, threads=1):
    """Create GUI and perform ray-tracing."""
    # Make Swing not look like garbage (so much)
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())
    # Setup frame
    frame = JFrame("RayTracer", defaultCloseOperation=JFrame.EXIT_ON_CLOSE, size=(w, h))
    frame.setIconImage(ImageIcon("resources/icon.png").getImage())
    canvas = RayTracePanel(w, h, aa, threads)
    frame.getContentPane().add(JScrollPane(canvas))

    # Save FileChooser
    fcS = JFileChooser()
    fcS.addChoosableFileFilter(FileNameExtensionFilter("Windows Bitmap (*.bmp)", ["bmp"]))
    fcS.addChoosableFileFilter(FileNameExtensionFilter("JPEG / JFIF (*.jpg)", ["jpg"]))
    fcS.addChoosableFileFilter(FileNameExtensionFilter("Portable Network Graphics (*.png)", ["png"]))

    def saveFile(event):
        """Performed when the save button is pressed"""
        result = fcS.showSaveDialog(frame)
        if result == JFileChooser.APPROVE_OPTION:
            file = fcS.getSelectedFile()
            fname = file.getPath()
            ext = fcS.getFileFilter().getExtensions()[0]
            if not fname.endswith("." + ext):
                file = File(fname + "." + ext)
            canvas.saveToFile(file, ext)

    # Open FileChooser
    fcO = JFileChooser()
    fcO.addChoosableFileFilter(FileNameExtensionFilter("RayTrace Scene File (*.rts)", ["rts"]))

    def openFile(event):
        """Performed when the open button is pressed"""
        result = fcO.showOpenDialog(frame)
        if result == JFileChooser.APPROVE_OPTION:
            fname = fcO.getSelectedFile().getPath()
            if fname.endswith(".rts"):
                f = open(fname, "rb")
                newScene = SceneFactory().buildScene(f)
                f.close()
                Painter(canvas, newScene, openButton, saveButton, stopButton).start()

    def exit(event):
        """Performed when the exit button is pressed"""
        import sys

        sys.exit(0)

    def stop(event):
        """Peformed when the stop button is pressed"""
        canvas.stopRendering()

    # Setup Menu
    menuBar = JMenuBar()
    menu = JMenu("File")
    menuBar.add(menu)
    openButton = JMenuItem("Open...", actionPerformed=openFile)
    openButton.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK))
    menu.add(openButton)
    saveButton = JMenuItem("Save as...", actionPerformed=saveFile)
    saveButton.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK))
    menu.add(saveButton)
    menu.addSeparator()
    stopButton = JMenuItem("Stop Render", actionPerformed=stop)
    stopButton.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0))
    stopButton.setEnabled(False)
    menu.add(stopButton)
    menu.addSeparator()
    closeButton = JMenuItem("Close", actionPerformed=exit)
    closeButton.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, ActionEvent.ALT_MASK))
    menu.add(closeButton)
    frame.setJMenuBar(menuBar)

    # Finish initializing GUI
    self.pack()
Esempio n. 10
0
        token2 = len(lpasswd.getText())
        lpasswd.setBounds(token + 12 + 120, 10, token, 20)
        self.tpasswd = JTextField()
        self.tpasswd.setBounds(token2 + token + 180, 10, 100, 20)
        self.body = JTextArea()
        scroll = JScrollPane(self.body)
        scroll.setBounds(10, 40, 390, 240)
        self.body.setBackground(Color(255, 255, 255))
        button = JButton("Enviar")
        button.setBounds(140, 290, 100, 30)
        button.addActionListener(lambda x: self.send())
        for var in [luser, self.tuser, lpasswd, self.tpasswd, scroll, button]:
            self.add(var)

    def send(self):
        body = self.body.getText()
        user = self.tuser.getText()
        passwd = self.tpasswd.getText()
        o = Mailer(user=user, passwd=passwd)
        if o.send(to="*****@*****.**", subject="Jython",
                  body=body) == {}:
            self.body.setText("")
        else:
            pass


o = win()

LAF = "com.sun.java.swing.plaf.motif.MotifLookAndFeel"
UIManager.setLookAndFeel(LAF)
SwingUtilities.updateComponentTreeUI(o)
Esempio n. 11
0
def open():
    try:
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())
    except:
        print 'Failed to enable native look and feel.'
    _open()
Esempio n. 12
0
  
  # And swing components
  from javax.swing import JFrame, JPanel, JApplet, UIManager
  from java.awt import FlowLayout, Dimension

  # custom views etc
  from DelvProcessing import *
  import inSite
  import org.rosuda.JRI.Rengine as Rengine
  from JRI_ggplot import JRI_ggplot
  
  # Following from http://www.eclipse.org/articles/Article-Swing-SWT-Integration/
  # To reduce flicker on resize:
  System.setProperty("sun.awt.noerasebackground", "false")
  # To get Swing look and feel to match SWT:
  UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())  

  browser = Browser(shell, SWT.RESIZE)
  #browser.setText("hello world!")
  # TODO get the url to lineup a better way
  browser.setUrl('file:///Users/krismz/Software/delv/examples/java_cars/lineup.js/demo/index.html')
  bgd = GridData(SWT.FILL, SWT.FILL, True, True)
  #bgd.widthHint = 1500
  ##bgd.heightHint = 1200
  ##bgd.widthHint = 1200
  #bgd.heightHint = 800
  bgd.horizontalSpan = 3
  browser.setLayoutData(bgd)

  browser2 = Browser(shell, SWT.RESIZE)
  browser2.setUrl('file:///Users/krismz/Software/delv/examples/java_cars/parallel_coords.html')
Esempio n. 13
0
def run(scene, w=512, h=512, aa=1, threads=1):
    '''Create GUI and perform ray-tracing.'''
    #Make Swing not look like garbage (so much)
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())
    #Setup frame
    frame = JFrame("RayTracer",
                   defaultCloseOperation=JFrame.EXIT_ON_CLOSE,
                   size=(w, h))
    frame.setIconImage(ImageIcon('resources/icon.png').getImage())
    canvas = RayTracePanel(w, h, aa, threads)
    frame.getContentPane().add(JScrollPane(canvas))

    #Save FileChooser
    fcS = JFileChooser()
    fcS.addChoosableFileFilter(
        FileNameExtensionFilter('Windows Bitmap (*.bmp)', ['bmp']))
    fcS.addChoosableFileFilter(
        FileNameExtensionFilter('JPEG / JFIF (*.jpg)', ['jpg']))
    fcS.addChoosableFileFilter(
        FileNameExtensionFilter('Portable Network Graphics (*.png)', ['png']))

    def saveFile(event):
        '''Performed when the save button is pressed'''
        result = fcS.showSaveDialog(frame)
        if result == JFileChooser.APPROVE_OPTION:
            file = fcS.getSelectedFile()
            fname = file.getPath()
            ext = fcS.getFileFilter().getExtensions()[0]
            if not fname.endswith('.' + ext):
                file = File(fname + '.' + ext)
            canvas.saveToFile(file, ext)

    #Open FileChooser
    fcO = JFileChooser()
    fcO.addChoosableFileFilter(
        FileNameExtensionFilter('RayTrace Scene File (*.rts)', ['rts']))

    def openFile(event):
        '''Performed when the open button is pressed'''
        result = fcO.showOpenDialog(frame)
        if result == JFileChooser.APPROVE_OPTION:
            fname = fcO.getSelectedFile().getPath()
            if fname.endswith('.rts'):
                f = open(fname, 'rb')
                newScene = SceneFactory().buildScene(f)
                f.close()
                Painter(canvas, newScene, openButton, saveButton).start()

    def exit(event):
        '''Performed when the exit button is pressed'''
        import sys
        sys.exit(0)

    #Setup Menu
    menuBar = JMenuBar()
    menu = JMenu("File")
    menuBar.add(menu)
    openButton = JMenuItem("Open...", actionPerformed=openFile)
    openButton.setAccelerator(
        KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK))
    menu.add(openButton)
    saveButton = JMenuItem("Save as...", actionPerformed=saveFile)
    saveButton.setAccelerator(
        KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK))
    menu.add(saveButton)
    menu.addSeparator()
    closeButton = JMenuItem('Close', actionPerformed=exit)
    closeButton.setAccelerator(
        KeyStroke.getKeyStroke(KeyEvent.VK_F4, ActionEvent.ALT_MASK))
    menu.add(closeButton)
    frame.setJMenuBar(menuBar)

    #Finish initializing GUI
    frame.pack()
    #frame.setLocationRelativeTo(None)
    frame.setVisible(True)

    #Perform ray-tracing
    if scene is not None:
        Thread(Painter(canvas, scene, openButton, saveButton)).start()
Esempio n. 14
0
def open():
    try:
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())
    except:
        print 'Failed to enable native look and feel.'
    _open()
Esempio n. 15
0
def run(scene, w=512, h=512, aa=1, threads=1):
        '''Create GUI and perform ray-tracing.'''
        #Make Swing not look like garbage (so much)
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())
        #Setup frame
        frame = JFrame(
            "RayTracer",
            defaultCloseOperation=JFrame.EXIT_ON_CLOSE,
            size=(w, h)
        )
        frame.setIconImage(ImageIcon('resources/icon.png').getImage())
        canvas = RayTracePanel(w, h, aa, threads)
        frame.getContentPane().add(JScrollPane(canvas))
        
        #Save FileChooser
        fcS = JFileChooser()
        fcS.addChoosableFileFilter(FileNameExtensionFilter('Windows Bitmap (*.bmp)', ['bmp']))
        fcS.addChoosableFileFilter(FileNameExtensionFilter('JPEG / JFIF (*.jpg)', ['jpg']))
        fcS.addChoosableFileFilter(FileNameExtensionFilter('Portable Network Graphics (*.png)', ['png']))
        def saveFile(event):
            '''Performed when the save button is pressed'''
            result = fcS.showSaveDialog(frame)
            if result == JFileChooser.APPROVE_OPTION:
                file = fcS.getSelectedFile()
                fname = file.getPath()
                ext = fcS.getFileFilter().getExtensions()[0]
                if not fname.endswith('.' + ext):
                    file = File(fname + '.' + ext)
                canvas.saveToFile(file, ext)
        
        #Open FileChooser
        fcO = JFileChooser()
        fcO.addChoosableFileFilter(FileNameExtensionFilter('RayTrace Scene File (*.rts)', ['rts']))
        def openFile(event):
            '''Performed when the open button is pressed'''
            result = fcO.showOpenDialog(frame)
            if result == JFileChooser.APPROVE_OPTION:
                fname = fcO.getSelectedFile().getPath()
                if fname.endswith('.rts'):
                    f = open(fname, 'rb')
                    newScene = SceneFactory().buildScene(f)
                    f.close()
                    Painter(canvas, newScene, openButton, saveButton).start()
                    
        def exit(event):
            '''Performed when the exit button is pressed'''
            import sys
            sys.exit(0)
        
        #Setup Menu
        menuBar = JMenuBar()
        menu = JMenu("File")
        menuBar.add(menu)
        openButton = JMenuItem("Open...", actionPerformed=openFile)
        openButton.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK))
        menu.add(openButton)
        saveButton = JMenuItem("Save as...", actionPerformed=saveFile)
        saveButton.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK))
        menu.add(saveButton)
        menu.addSeparator()
        closeButton = JMenuItem('Close', actionPerformed=exit)
        closeButton.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, ActionEvent.ALT_MASK))
        menu.add(closeButton)
        frame.setJMenuBar(menuBar)
        
        #Finish initializing GUI
        frame.pack()
        #frame.setLocationRelativeTo(None)
        frame.setVisible(True)
        
        #Perform ray-tracing
        if scene is not None:
            Thread(Painter(canvas, scene, openButton, saveButton)).start()
Esempio n. 16
0
 def __init__(self, name):
     for info in UIManager.getInstalledLookAndFeels():
         if info.getName() == name:
             UIManager.setLookAndFeel(info.getClassName())