Exemple #1
0
 def setMenuBar(self):
     menuBar = JMenuBar()
     
     menuApp = JMenu("Apps")
     menuApp.setMnemonic('A')
     
     menuSettings = JMenu("Settings")
     menuSettings.setMnemonic('S')
     
     #set submenus
     menuPlayNow = JMenu("PlayNow" )
     
     menuPlayNowOpen = JMenuItem("Open", actionPerformed = (lambda x, param="open": self.playNowApp_startThread(param)) )
     menuPlayNow.add(menuPlayNowOpen)
     
     menuPlayNowLogin = JMenuItem("Login", actionPerformed = lambda x, action="playNowLogin": self.playNowApp_startThread(action) )
     menuPlayNow.add(menuPlayNowLogin)
     
     menuPlayNowClose = JMenuItem("Close", actionPerformed = lambda x, action="playNowClose": self.playNowApp_startThread(action) )
     menuPlayNow.add(menuPlayNowClose)
     
     menuPokerTable = JMenu("PokerTable")
     menuPokerTableJoin = JMenuItem("Find Practice Table", actionPerformed = lambda x, action="practiceTable": self.playNowApp_startThread(action) )
     menuPokerTable.add(menuPokerTableJoin)
     
     menuPokerTableJoin = JMenuItem("Join Table", actionPerformed = lambda x, action="joinTable": self.playNowApp_startThread(action) )
     menuPokerTable.add(menuPokerTableJoin)
     
     menuPokerTableAddChips = JMenuItem("Add Chips", actionPerformed = lambda x, action="addChips": self.playNowApp_startThread(action) )
     menuPokerTable.add(menuPokerTableAddChips)
     
     menuPokerTableSitOut = JMenuItem("Sit Out", actionPerformed = lambda x, action="sitOut": self.playNowApp_startThread(action) )
     menuPokerTable.add(menuPokerTableSitOut)
     
     menuPokerTableLeaveTable = JMenuItem("Leave Table", actionPerformed = lambda x, action="leaveTable": self.playNowApp_startThread(action) )
     menuPokerTable.add(menuPokerTableLeaveTable)
     
     menuPokerAppExit = JMenuItem("Exit")
     
     menuApp.add(menuPlayNow)
     menuApp.add(menuPokerTable)
     menuApp.addSeparator()
     menuApp.add(menuPokerAppExit)
     
     menuBar.add(menuApp)
     menuBar.add(menuSettings)
     
     self._frame.setJMenuBar(menuBar)
def DisplayStreetTable (collection):
    columns=list(
        (
            ("Name","name"),
            )
        )
    tm= ObjectTableModel(collection,columns)
    frame = MyFrame("Street Table")
    frame.setSize(800, 1200)
    frame.setLayout(BorderLayout())
    table = JTable(tm)
    table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS)
    header = table.getTableHeader()
    header.setUpdateTableInRealTime(True)
    header.setReorderingAllowed(True);
    scrollPane = JScrollPane()
    scrollPane.getViewport().setView((table))
#    copyButton = JButton('Merge') #,actionPerformed=self.noAction
#    frame.add(copyButton)

    listener=MyListener(table)
    table.addMouseListener(listener)
    table.addKeyListener(listener)

    menubar = JMenuBar()
    file = JMenu("Edit")
    file.setMnemonic(KeyEvent.VK_E)

    lookup = JMenuItem("Lookup",actionPerformed=frame.LookupEvent)
    lookup.setMnemonic(KeyEvent.VK_L)

    file.add(lookup)


    menubar.add(file)



    frame.setJMenuBar(menubar)

    frame.add(scrollPane)


    frame.pack();
    frame.setSize(frame.getPreferredSize());
    frame.show()
Exemple #3
0
    def initUI(self):
        menubar = JMenuBar()

        start = JMenu("Start")
        start.setMnemonic(KeyEvent.VK_S)

        apps = JMenu("Applications")
        apps.setPreferredSize(Dimension(200, 35))
        apps.setToolTipText("Stylus Applications")
        web = JMenuItem("Internet", actionPerformed=self.internet)
        web.setPreferredSize(Dimension(200, 35))
        web.setToolTipText("Stylus Web Browser")
        apps.add(web)
        image = JMenuItem("Image Viewer", actionPerformed=self.photos)
        image.setPreferredSize(Dimension(200, 35))
        image.setToolTipText("Stylus Image Viewer")
        apps.add(image)
        start.add(apps)

        utility = JMenu("Utility")
        utility.setPreferredSize(Dimension(200, 35))
        utility.setToolTipText("Stylus Utility")
        voice = JMenuItem("Anna", actionPerformed=self.vocal)
        voice.setPreferredSize(Dimension(200, 35))
        voice.setToolTipText("Anna Vocal Assistant")
        utility.add(voice)
        clc = JMenuItem("Calculator", actionPerformed=self.calc)
        clc.setPreferredSize(Dimension(200, 35))
        clc.setToolTipText("Stylus Calculator")
        utility.add(clc)
        fman = JMenuItem("File Manager", actionPerformed=self.file_manager)
        fman.setPreferredSize(Dimension(200, 35))
        fman.setToolTipText("Stylus File Manager")
        utility.add(fman)
        txted = JMenuItem("Notepad", actionPerformed=self.notepad)
        txted.setPreferredSize(Dimension(200, 35))
        txted.setToolTipText("Stylus Notepad")
        utility.add(txted)
        terminal = JMenuItem("Terminal (as root)",
                             actionPerformed=self.lxterminal)
        terminal.setPreferredSize(Dimension(200, 35))
        terminal.setToolTipText("Stylus Terminal")
        utility.add(terminal)
        start.add(utility)

        games = JMenu("Games")
        games.setPreferredSize(Dimension(200, 35))
        games.setToolTipText("PyOS Games")
        g1 = JMenuItem("2048", actionPerformed=self.d2048)
        g1.setPreferredSize(Dimension(200, 35))
        g1.setToolTipText("Play 2048 Game")
        games.add(g1)

        g2 = JMenuItem("Ping Pong", actionPerformed=self.ppong)
        g2.setPreferredSize(Dimension(200, 35))
        g2.setToolTipText("Play Ping Pong Game")
        games.add(g2)

        start.add(games)

        start.addSeparator()

        exit = JMenuItem("Exit", actionPerformed=self.onExit)
        exit.setPreferredSize(Dimension(200, 35))
        exit.setToolTipText("Stylus Exit")
        start.add(exit)

        menubar.add(start)

        file = JMenu("File")
        file.setMnemonic(KeyEvent.VK_F)

        tk = Toolkit.getDefaultToolkit()
        xSize = (int(tk.getScreenSize().getWidth()))
        ySize = (int(tk.getScreenSize().getHeight()))

        self.setSize(xSize, ySize)

        filebg = open("/icons/background.txt", "r")
        path = filebg.readline()

        filebg.close()

        panel2 = bg.background(path, self.getWidth(), self.getHeight() - 100)

        theme = JMenuItem("Change background",
                          actionPerformed=lambda e: self.bg(panel2, e))
        theme.setPreferredSize(Dimension(200, 35))
        theme.setToolTipText("Stylus Background")

        file.add(theme)

        menubar.add(file)

        info = JMenu("?")
        info.setMnemonic(KeyEvent.VK_I)

        inf = JMenuItem("Info", actionPerformed=self.onInfo)
        inf.setToolTipText("Stylus Information")

        info.add(inf)

        menubar.add(info)

        menubar.add(Box.createHorizontalGlue())

        timedate = JMenu(time.strftime("%a, %Y %b %d, %H:%M"))
        timedate.setMnemonic(KeyEvent.VK_C)
        calendar = JMenuItem("Calendar", actionPerformed=self.calendar)
        calendar.setPreferredSize(Dimension(200, 35))
        timedate.add(calendar)

        menubar.add(timedate)
        menubar.add(JLabel("  "))

        menubar.setPreferredSize(Dimension(200, 35))

        self.setJMenuBar(menubar)

        self.setTitle("Stylus OS")
        self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
        #self.setSize(1360, 768)
        self.setLocationRelativeTo(None)
        """time = JPanel()
        time.setBorder(BorderFactory.createEtchedBorder())
        time.setBackground(Color(153, 203, 255))
        time.setLayout(GridLayout(0, 1))
        
        f = Font("", Font.PLAIN, 60)
        t = JLabel("11:51")
        t.setHorizontalAlignment(JLabel.CENTER)
        t.setFont(f)
        time.add(t)
        
        f2 = Font("", Font.PLAIN, 50)
        d = JLabel("Tuesday, 2016/07/12")
        d.setHorizontalAlignment(JLabel.CENTER)
        d.setFont(f2)
        time.add(d)
        
        self.getContentPane().add(time)
        self.add(time, BorderLayout.NORTH)"""

        panel = JPanel()
        self.getContentPane().add(panel)

        b0 = JButton(ImageIcon("/icons/file-manager.png"),
                     actionPerformed=self.file_manager)
        b0.setToolTipText("File Manager")
        panel.add(b0)
        b1 = JButton(ImageIcon("/icons/internet.png"),
                     actionPerformed=self.internet)
        b1.setToolTipText("Internet")
        panel.add(b1)
        b2 = JButton(ImageIcon("/icons/mail.png"))
        b2.setToolTipText("Mail")
        #panel.add(b2)
        b3 = JButton(ImageIcon("/icons/music.png"))
        b3.setToolTipText("Music")
        #panel.add(b3)
        b4 = JButton(ImageIcon("/icons/video.png"))
        b4.setToolTipText("Video")
        #panel.add(b4)
        b5 = JButton(ImageIcon("/icons/photos.png"),
                     actionPerformed=self.photos)
        b5.setToolTipText("Photos")
        panel.add(b5)
        b6 = JButton(ImageIcon("/icons/calculator.png"),
                     actionPerformed=self.calc)
        b6.setToolTipText("Calculator")
        panel.add(b6)
        b7 = JButton(ImageIcon("/icons/notepad.png"),
                     actionPerformed=self.notepad)
        b7.setToolTipText("Notepad")
        panel.add(b7)
        b8 = JButton(ImageIcon("/icons/settings.png"))
        b8.setToolTipText("Settings")
        #panel.add(b8)
        b9 = JButton(ImageIcon("/icons/trash.png"))
        b9.setToolTipText("Trash")
        #panel.add(b9)

        #panel.setBackground(Color(153, 203, 255))

        self.add(panel, BorderLayout.SOUTH)

        self.getContentPane().add(panel2)

        #panel2.setBorder(BorderFactory.createEtchedBorder())
        #panel2.setLayout(GridLayout(0, 1))
        #panel.setLayout(None)
        #panel2.setBackground(Color(153, 203, 255))

        #panel2.add(JLabel(ImageIcon("logo.png")))

        #panel2.add(JButton("Icon 0"))
        #panel2.add(JButton("Icon 1"))
        #panel2.add(JButton("Icon 2"))
        #panel2.add(JButton("Icon 3"))
        #panel2.add(JButton("Icon 4"))
        #panel2.add(JButton("Icon 5"))
        #panel2.add(JButton("Icon 6"))
        #panel2.add(JButton("Icon 7"))
        #panel2.add(JButton("Icon 8"))
        #panel2.add(JButton("Icon 9"))

        self.add(panel2)

        self.setExtendedState(JFrame.MAXIMIZED_BOTH)
        self.setUndecorated(True)
        self.setVisible(True)
Exemple #4
0
def createMenuBar(manager):
    global menuHandles, isDominant, isTemporal
    menuHandles = {}
    menuBar = JMenuBar()

    fmenu = JMenu("File")
    menuHandles['File'] = fmenu
    fmenu.setMnemonic(KeyEvent.VK_F)
    menuBar.add(fmenu)
    fmenu.add(createMenuItem('Open Genepop data', "Open", manager))
    fmenu.add(createMenuItem('Use Example data', "Example", manager))
    fmenu.addSeparator()
    fmenu.add(createMenuItem('Citation', "Citation", manager))
    fmenu.addSeparator()
    fmenu.add(createMenuItem("Exit", "Exit", manager))

    if not isTemporal:
        pmenu = JMenu("Populations")
        menuHandles['Populations'] = pmenu
        pmenu.setEnabled(False)
        pmenu.setMnemonic(KeyEvent.VK_P)
        menuBar.add(pmenu)
        pmenu.add(createMenuItem('Load population names', "LoadPop", manager))
        pmenu.add(createMenuItem('Edit population names', "EditPop", manager))
        pmenu.add(createMenuItem('Save population names', "SavePop", manager))

    umenu = JMenu("Data used")
    menuHandles['Data used'] = umenu
    umenu.setEnabled(False)
    umenu.setMnemonic(KeyEvent.VK_U)
    menuBar.add(umenu)
    umenu.add(createMenuItem('Loci Analyzed', "ChooseLoci", manager))
    if isTemporal:
        umenu.add(createMenuItem('Samples Analyzed', "ChoosePops", manager))
    else:
        umenu.add(createMenuItem('Populations Analyzed', "ChoosePops", manager))

    if isDominant:
        fdmenu = JMenu("DFDist")
    elif isTemporal:
        fdmenu = JMenu("FTemp")
    else:
        fdmenu = JMenu("FDist")
    menuHandles['FDist'] = fdmenu
    fdmenu.setEnabled(False)
    fdmenu.setMnemonic(KeyEvent.VK_D)
    menuBar.add(fdmenu)
    if isTemporal:
        fdmenu.add(createMenuItem('Run FTemp', "RunFDist", manager))
    else:
        fdmenu.add(createMenuItem('Run FDist', "RunFDist", manager))
    item5000 = createMenuItem('Run more 5000 sims', "Run5000", manager)
    item5000.setEnabled(False)
    menuHandles['item5000'] = item5000
    fdmenu.add(item5000)
    checkLoci = createMenuItem('Check Loci Status', "CheckLoci", manager)
    checkLoci.setEnabled(False)
    menuHandles['checkLoci'] = checkLoci
    fdmenu.add(checkLoci)

    gmenu = JMenu("Graphic")
    gmenu.setEnabled(False)
    menuHandles['Graphic'] = gmenu
    gmenu.setMnemonic(KeyEvent.VK_G)
    menuBar.add(gmenu)
    gmenu.add(createMenuItem('Colors and loci labels', "ConfGrp", manager))
    #gmenu.add(createMenuItem('Save Graphic as PNG', "SavePNG", manager))
    gmenu.add(createMenuItem('Save as PNG', "SavePNG", manager))
    gmenu.add(createMenuItem('Export as PDF', "SavePDF", manager))
    gmenu.add(createMenuItem('Export as SVG', "SaveSVG", manager))

    menuBar.add(Box.createHorizontalGlue())

    hmenu = JMenu("Help")
    hmenu.setMnemonic(KeyEvent.VK_H)
    menuBar.add(hmenu)
    hmenu.add(createMenuItem('Help', "Help", manager))

    return menuBar