Пример #1
0
 def _ui_main(self):
   log2("UI thread: ui running.")
   def on_load_cb(mc):
     log2("UI thread: ui loaded. Notifying test thread.")
     self._mc = mc
     self._loaded.set()
   ui.run(self._options, on_load_cb)
   log2("UI thread: ui stoped.")
Пример #2
0
def main():
	init()
	args = getArgs()
	global mode
	mode = args.mode
	storage, count = createStore(args.path, args.start_rev, last=args.last)
	if args.stats:
		stats.gather_stats(storage, args.path.split("/")[-1], args.start_rev, args.last, args.phase, count)
		return

	ui.run(storage, args.mode)
Пример #3
0
def start():
    time.sleep(0.5)
    while True:
        global dist
        dist = distance()
        print("Measured Distance = {:.2f} cm".format(dist))  #debug
        if dist < distmin and dist > distmax:
            print('distance.start:dist<distmin')
            if main.usemulti:
                ui.run_multi()
            else:
                ui.run()
        time.sleep(whiletime)
Пример #4
0
def run_ui(options, args):
    global ui
    if not ui:
        print "Cannot run UI.\n"
        return 255

    settings = new_settings()

    # defaults
    settings.register("SettingsVersion", int, 0)
    settings.register("Editor", str, None)
    global CUR_SETTINGS_VERSION
    if settings.SettingsVersion != CUR_SETTINGS_VERSION:
        _first_run(settings)

    # update settings object based on the editor stuffs
    if hasattr(options, "gvim") and options.gvim:
        settings.set_temporarily("Editor", "GVimEditor")
    elif hasattr(options, "emacs") and options.emacs:
        settings.set_temporarily("Editor", "EmacsEditor")
    elif hasattr(options, "sourceview") and options.sourceview:
        settings.set_temporarily("Editor", "SourceViewEditor")

    if settings.Editor == 'GVimEditor':
        import ui.gvim_editor
        ok, error = ui.gvim_editor.SanityCheck(settings)
        if not ok:
            print error
            return 255

    # debuger init
    settings.register("ExecLaunch", list, None)
    settings.register("ExecAttach", int, -1)
    res = process_options(options, args)
    if not res:
        return
    if hasattr(res, 'ExecAttach'):
        settings.set_temporarily("ExecAttach", res.ExecAttach)
    elif hasattr(res, 'ExecLaunch'):
        settings.set_temporarily("ExecLaunch", res.ExecLaunch)

    # UI init
    ui.run(settings)  # engages main loop
    return 0
Пример #5
0
def run_ui(options, args):
  global ui
  if not ui:
    print "Cannot run UI.\n"
    return 255

  settings = new_settings()

  # defaults
  settings.register("SettingsVersion", int, 0)
  settings.register("Editor", str, None)
  global CUR_SETTINGS_VERSION
  if settings.SettingsVersion != CUR_SETTINGS_VERSION:
    _first_run(settings)

  # update settings object based on the editor stuffs
  if hasattr(options,"gvim") and options.gvim:
    settings.set_temporarily("Editor", "GVimEditor")
  elif hasattr(options,"emacs") and options.emacs:
    settings.set_temporarily("Editor", "EmacsEditor")
  elif hasattr(options,"sourceview") and options.sourceview:
    settings.set_temporarily("Editor", "SourceViewEditor")

  if settings.Editor == 'GVimEditor':
    import ui.gvim_editor
    ok, error = ui.gvim_editor.SanityCheck(settings)
    if not ok:
      print error
      return 255

  # debuger init
  settings.register("ExecLaunch", list, None)
  settings.register("ExecAttach", int, -1)
  res = process_options(options, args)
  if not res:
    return
  if hasattr(res,'ExecAttach'):
    settings.set_temporarily("ExecAttach", res.ExecAttach)
  elif hasattr(res,'ExecLaunch'):
    settings.set_temporarily("ExecLaunch", res.ExecLaunch)

  # UI init
  ui.run(settings) # engages main loop
  return 0
Пример #6
0
def run():
    """Runs the carpark system in parallel"""
    depart = Channel()
    arrive = Channel()
    arrive_but = Channel()
    depart_but = Channel()
    Parallel(
        ui.run(arrive_but.writer(), depart_but.reader()),
        carpark_arrive.run(arrive.writer(), arrive_but.reader()),
        carpark_control.run(arrive.reader(), depart.reader()),
        carpark_depart.run(depart.writer(), depart_but.reader())
    )
Пример #7
0
        # tell player recharging
        m = 'recharging health\n'
        # set health to full
        self.health = 100

        return m

    ## method to call when a chest room is
    ## reached
    def chest(self):
        m = ''
        # if the player has the key
        if self.key:
            # change player state to won
            self.state = 'won'
            # return win message
            m += 'You won!!\n'
        # otherwise tell player they need a key
        else:
            m += 'You need to find the key.\n'

        return m

if __name__ == '__main__':
    # create new player
    p = player(level=1)
    # create ui
    ui = ui.ui(p)
    # run ui
    ui.run()
Пример #8
0
 def run(self):
     ui.run()
Пример #9
0
from ui import run

if __name__ == '__main__':
    run()
import ui
import finance
import settings

ui.run(1000, 800)
Пример #11
0
import threading

import server
import model
import ui

large = True

field = model.Field()
field.create((1, 1), model.test_id(1))
field.create((2, 1), model.test_id(2))
field.create((3, 1), model.test_id(3))
if large:
    field.create((2, 2), model.gen_id())
    field.create((3, 2), model.gen_id())
    field.create((3, 3), model.gen_id())
    field.create((3, 4), model.gen_id())
    field.create((2, 4), model.gen_id())
    field.create((1, 4), model.gen_id())
    field.create((1, 3), model.gen_id())
    field.create((1, 2), model.gen_id())
    #field.create((2, 3), model.gen_id())

server = server.CellServer(('localhost', 6788), field)
thread = threading.Thread(target=server.serve_forever)
thread.start()

ui.run(sys.argv, field)

print("Application has closed")
os._exit(0)