Exemplo n.º 1
0
class ProgramGUI(tk.Tk):

    def __init__(self):
        super().__init__()
        self.option_add('*tearOff', tk.FALSE)
        self.columnconfigure(0, weight=1)
        self.rowconfigure(0, weight=1)
        self.title('WiFi Password Revealer')
        self.screen = MainScreen(self)
        self.menu_bar = menus.MenuBar(self, self.screen)
        self.right_click_menu = menus.PopupMenu(self, self.screen)

        # Keyboard shortcuts
        self.bind_all('<Control-c>',
                      lambda event=None: gf.copy_selection(self, self.screen.results_display))
        self.bind_all('<F5>',
                      lambda event=None: self.screen.refresh_results_display())
        self.bind_all('<Control-a>',
                      lambda event=None: self.screen.select_all())
        self.bind_all('<Control-d>',
                      lambda event=None: self.screen.deselect_all())
        self.bind_all('<Control-i>',
                      lambda event=None: self.screen.invert_selection())
        self.bind_all('<Control-s>',
                      lambda event=None: gf.save_as(self.screen.results_display))
Exemplo n.º 2
0
    def build(self):
        self.manager = ScreenManager()

        self.bind(on_start=self.post_build_init)

        self.manager.add_widget(Login(name='login'))
        self.manager.add_widget(MainScreen(name='mainscreen'))
        self.manager.add_widget(WorkItems(name='workitems'))

        return self.manager
Exemplo n.º 3
0
    def build(self):
        self.title = 'PocketCosmos'
        self.calc_iconsize()
        self.settings = ConfigController('settings.json')

        self.sound_manager = SoundManager(settings=self.settings)

        self.logic = Logic(settings=self.settings,
                           sound_manager=self.sound_manager)

        self.screenmanager = ScreenManager()

        self.mainscreen = MainScreen(logic=self.logic,
                                     iconsize=self.iconsize,
                                     iconratio_x=self.iconratio_x,
                                     iconratio_y=self.iconratio_y,
                                     name='main')

        # MenuScreen does not need logic
        self.menuscreen = MenuScreen(name='menu')

        self.settingsscreen = SettingsScreen(logic=self.logic,
                                             iconsize=self.iconsize,
                                             iconratio_x=self.iconratio_x,
                                             iconratio_y=self.iconratio_y,
                                             name='settings')

        self.savegamescreen = SavegameScreen(logic=self.logic,
                                             iconsize=self.iconsize,
                                             iconratio_x=self.iconratio_x,
                                             iconratio_y=self.iconratio_y,
                                             name='savegames')

        self.creditsscreen = CreditsScreen(iconsize=self.iconsize,
                                           name='credits')

        # order adding here reflects which screen is shown first!
        self.screenmanager.add_widget(self.menuscreen)
        self.screenmanager.add_widget(self.mainscreen)
        self.screenmanager.add_widget(self.settingsscreen)
        self.screenmanager.add_widget(self.savegamescreen)
        self.screenmanager.add_widget(self.creditsscreen)

        self.logic.apply_settings()

        return self.screenmanager
Exemplo n.º 4
0
 def authCallback(self, username, result):
    self.login = None
    if result == True:
       self.loggedInUsername = username
       self.tk.wm_deiconify()
       self.mainscreen = MainScreen( username=self.loggedInUsername,
                                    jobqueue=self.jobqueue,
                                    cloudAdapter=self.cloudAdapter,
                                    conn=self.conn,
                                    authHandler=self.authorize,
                                    messageDisplay=self.messageDisplay,
                                    logoutCb=self.logoutCallback,
                                    maxsize=self.maxsize,
                                    master=self.tk, width=self.tk['width'], height=self.tk['height'])
       self.tk.wm_attributes('-fullscreen', 1)
       if self.mainscreen.local is not None and self.mainscreen.local.joblist is not None:
          self.mainscreen.local.joblist.focus_set()
          if self.mainscreen.local.joblist.size() > 0:
             self.mainscreen.local.joblist.selection_set(0)
    else:
       self.loggedInUsername = None
       self.login = AuthDialog(self.authCallback, master=self.tk)
Exemplo n.º 5
0
class Controller(object):
   def __init__(self, private, authname, public='public', gridlist=['localhost'], tk=None, maxsize=2147483647, cloudsize=2147483647):
      if tk != None: 
         self.tk = tk
      else:
         self.tk = Tk()
      self.tk['width']  = self.tk.winfo_screenwidth()
      self.tk['height'] = self.tk.winfo_screenheight()
      self.tk.wm_title('Columbia University NINJa Printing System')
      self.tk.setvar(name='PRINT_INTERLOCK', value='0')
      print self.tk.getvar(name='PRINT_INTERLOCK')
      self.publicName = public
      self.privateName = private
      self.gridlist = gridlist
      self.maxsize = maxsize
      self.loggedInUsername = None
      self.login = None
      self.mainscreen = None
      self.conn = cups.Connection() 
      self.messageDisplay = MessageDisplay()
      
      self.authorize = PageServerAuth(private, authname, lambda: random.uniform(16, 4294967295), 
                                      self.messageDisplay, self.conn)
      unipattern = re.compile('(?!.{9})([a-z]{2,7}[0-9]{1,6})')
      self.mcast = MulticastMember('233.0.14.56', 34426, 17, unipattern)
      
      for attempts in range(3):
         try:
            self.cloudAdapter = CloudAdapter('/tmp/keepersock', maxsize=cloudsize)
            self.cloudAdapter.registerGridList(self.gridlist)
            break
         except OSError:
            self.daemonlog = file('multicast.log', mode='a', buffering=0)
            self.daemon = Popen('./multicast', stdin=None, stdout=self.daemonlog, stderr=self.daemonlog)
            time.sleep(1)

      self.jobqueue = JobQueue(unipattern=unipattern,
                               conn=self.conn,
                               multicastHandler=self.mcast,
                               cloudAdapter=self.cloudAdapter,
                               maxsize=maxsize)

      self.tk.bind_all('<Key-Tab>', 'tk::TabToWindow [tk_focusNext %W]', add=False)
      self.tk.bind_all('<Key-BackSpace>', self.hardReset)
      self.nextRefresh = self.tk.after_idle(self.refreshQueue)


   def hardReset(self, event):
      if event.state == 12 or event.state == 20:
         print >> sys.stderr, time.time(), 'Performing Controller.hardReset()'
         self.tk.after_cancel(self.nextRefresh)
         if self.mainscreen is not None:
            self.mainscreen.event_generate('<<Finished>>')
            self.mainscreen.after_cancel(self.mainscreen.autologout)
            if self.mainscreen.local is not None:
               self.mainscreen.local.after_cancel(self.mainscreen.local.nextRefresh)
            if self.mainscreen.remote is not None:
               self.mainscreen.remote.after_cancel(self.mainscreen.remote.nextRefresh)
            self.mainscreen.destroy()
            self.mainscreen = None
         
         self.messageDisplay.releaseInterlock()
         self.messageDisplay.registerMessageFrame(None)
         self.messageDisplay.clearQuota()
         self.tk.wm_attributes('-fullscreen', 0)
         self.tk.bind_all('<Key-Tab>', 'tk::TabToWindow [tk_focusNext %W]', add=False)
         self.initialQueueLoad()
         self.login = AuthDialog(self.authCallback, master=self.tk)
         self.login.takefocus()
         self.tk.wm_withdraw()
         self.jobqueue.refresh()
         self.nextRefresh = None


   def authCallback(self, username, result):
      self.login = None
      if result == True:
         self.loggedInUsername = username
         self.tk.wm_deiconify()
         self.mainscreen = MainScreen( username=self.loggedInUsername,
                                      jobqueue=self.jobqueue,
                                      cloudAdapter=self.cloudAdapter,
                                      conn=self.conn,
                                      authHandler=self.authorize,
                                      messageDisplay=self.messageDisplay,
                                      logoutCb=self.logoutCallback,
                                      maxsize=self.maxsize,
                                      master=self.tk, width=self.tk['width'], height=self.tk['height'])
         self.tk.wm_attributes('-fullscreen', 1)
         if self.mainscreen.local is not None and self.mainscreen.local.joblist is not None:
            self.mainscreen.local.joblist.focus_set()
            if self.mainscreen.local.joblist.size() > 0:
               self.mainscreen.local.joblist.selection_set(0)
      else:
         self.loggedInUsername = None
         self.login = AuthDialog(self.authCallback, master=self.tk)
         #self.login.wm_title('Columbia University NINJa Printing System')


   def logoutCallback(self):
       if (self.messageDisplay.getInterlock() == '1'):
          return
       self.messageDisplay.registerMessageFrame(None)
       self.tk.wm_attributes('-fullscreen', 0)
       self.mainscreen.destroy()
       self.mainscreen = None
       self.messageDisplay.clearQuota()
       self.tk.bind_all('<Key-Tab>', 'tk::TabToWindow [tk_focusNext %W]', add=False)
       self.login = AuthDialog(self.authCallback, master=self.tk)
       self.login.takefocus()
       self.tk.wm_withdraw()

   def refreshQueue(self):
       if self.nextRefresh is not None:
          self.tk.after_cancel(self.nextRefresh)
       self.jobqueue.refresh(interjobHook=self.tk.update_idletasks)
       self.nextRefresh = self.tk.after(6000, self.refreshQueue)


   def initialQueueLoad(self):
       numJobs = len(self.conn.getJobs(which_jobs='not-completed'))
       startupMessage = Toplevel(width=600, height=150, master=self.tk)
       Label(text='Please wait, this NINJa is starting up\nThis may take several minutes',
             master=startupMessage).pack(side=TOP)
       progress = ttk.Progressbar(length=250, maximum=numJobs, master=startupMessage)
       progress.pack(side=BOTTOM, pady=8)
       startupMessage.wm_geometry('%dx%d+%d+%d' % (600, 60, 350, 480))
       progress.update_idletasks()
       def incrementBar():
          progress.step()
          progress.update_idletasks()
       self.jobqueue.refresh(interjobHook=incrementBar, force=True)
       startupMessage.destroy()
       print >> sys.stderr, time.time(), 'Finished initial load of jobQueue'
       self.login = AuthDialog(self.authCallback, master=self.tk)
       self.login.wm_title('Columbia University NINJa Printing System')
       self.login.takefocus()
       self.tk.wm_withdraw()
       self.nextRefresh = self.tk.after_idle(self.refreshQueue)
       

   def downloadBulletins(self, url):
         slash = url[8:].index('/') + 8
         servername = url[8:slash]
         http = httplib.HTTPSConnection(servername)
         http.request("GET", url)
         resp = http.getresponse()
         print resp.status, resp.reason
         xml = resp.read()
         print xml
         root = ET.fromstring(xml)
         self.messageDisplay.bulletin(root, 'bulletinBoard')
         self.messageDisplay.update()


   def start(self):
         self.conn.enablePrinter(self.privateName)
         self.conn.acceptJobs(self.privateName)
         self.conn.disablePrinter(self.publicName, reason="NINJa release required")
         self.conn.acceptJobs(self.publicName)
         print >> sys.stderr, time.time(), 'Starting Controller and accepting incoming jobs'
         self.tk.after_idle(self.initialQueueLoad)
         self.tk.mainloop()


   def stop(self):
         print 'Stopping Controller and rejecting incoming jobs'
         if self.mainscreen != None:
            self.mainscreen.destroy()
         if self.login != None:
            self.login.destroy()
         self.tk.destroy()
         self.conn.rejectJobs(self.publicName)
         self.conn.rejectJobs(self.privateName)
         self.conn.disablePrinter(self.privateName)
Exemplo n.º 6
0
 def build(self):
     self.title = "Master Detail Demo"
     return MainScreen()
Exemplo n.º 7
0
import kivy
kivy.require('1.10.0') # replace with your current kivy version !

from kivy.app import App
from kivy.uix.screenmanager import ScreenManager, Screen

import serial

from mainscreen import MainScreen
from vehicle import Vehicle

#Create screenmanager
sm = ScreenManager()
sm.add_widget(MainScreen(sm, name='Mainscreen'))

class Coopvehicles(App):
    def build(self):
        return sm
    
if __name__ == '__main__':
    Coopvehicles().run()
Exemplo n.º 8
0
 def build(self):
     # Instantiate Screen Manager and add a child widget-- the Main Screen
     # Root widget is RoboScreenManager
     sm = RoboScreenManager(transition=NoTransition())
     sm.add_widget(MainScreen(name='main'))
     return sm
Exemplo n.º 9
0
# -*- coding: utf-8 -*-
"""
this is the launcher for the C-Cruiser Engineering GUI
"""
import sys

from PySide.QtGui import QApplication
from c_cruiser_production_gui_main import MainWindow
from mainscreen import MainScreen

#APP = QApplication(sys.argv)
# from view__ui import MainWindow
#MYAPP = MainWindow()
#MYAPP.show()
#sys.exit(APP.exec_())

APP = QApplication(sys.argv)
window=MainScreen()
#APP.setStyle('mac')
window.show()
#window.inspect.show()
#print("Flexo Prime Time")

sys.exit(APP.exec_())