Example #1
0
 def show_canvas(self):
     self.canvas_pic = tk.Canvas(self, bg="white", height=1, width=1)
     display.load([(display.new_window_canvas_id, self.canvas_pic)],
                  self.picture_file, max(1, int(self.entry_x.get())),
                  max(1, int(self.entry_y.get())))
     self.canvas_pic.grid(column=0, row=0)
     self.loaded = True
Example #2
0
    def _run_init(self):
        """Initialize the application before running.

        Returns: None
        """
        display.load('flamingo.backends.display.pygame_display',
                     'flamingo.backends.event.pygame_event')
        display.init(800, 600, self.data.screen_title)

        ## OpenGL
        gl.glShadeModel(gl.GL_SMOOTH)
        gl.glClearColor(0, 0, 0, 1)
        gl.glDisable(gl.GL_DEPTH_TEST)
        gl.glDisable(gl.GL_LIGHTING)
        
        gl.glEnable(gl.GL_BLEND)
        gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)
        
        gl.glEnable(gl.GL_POINT_SMOOTH)
        gl.glEnable(gl.GL_LINE_SMOOTH)
        gl.glEnable(gl.GL_POLYGON_SMOOTH)

        # Flamingo
        self.data.eventlistener.bind(self.quit_all, constants.QUIT, constants.QUIT)

        audio.mixer.init()
        self.quit = False
Example #3
0
    def __init__(self, *args, **kwargs):

        self.sftp_client = dict()

        self.centerwidget, self.rightwidget, self.leftwidget = ui.load()

        # INIT FORMS
        self.computationForm = None
        self._detectorForm = None
        self._scatteringForm = None

        # SETUP FEATURES
        featuremanager.layout = ui.leftwidget.featuresList
        featuremanager.load()

        # INIT EXPERIMENT
        self.newExperiment()

        # WIREUP CONTROLS
        self.leftwidget.addFeatureButton.clicked.connect(
            featuremanager.addLayer)
        self.leftwidget.addSubstrateButton.clicked.connect(
            featuremanager.addSubstrate)
        self.leftwidget.addParticleButton.clicked.connect(
            featuremanager.addParticle)
        #self.leftwidget.showComputationButton.clicked.connect(self.showComputation)
        self.leftwidget.showDetectorButton.clicked.connect(self.showDetector)
        self.leftwidget.addParticleButton.setMenu(ui.particlemenu)
        self.leftwidget.save.clicked.connect(self.save)
        self.leftwidget.load.clicked.connect(self.load)

        # RUN MENU
        self.runmenu = QtGui.QMenu()
        self.runmenu.addAction(QtGui.QIcon('xicam/gui/icons_34.png'),
                               "Run Local", self.runLocal)
        self.runmenu.addAction(QtGui.QIcon('xicam/gui/icons_40.png'),
                               "Run Remote", self.runRemote)
        self.runmenu.addAction(QtGui.QIcon('xicam/gui/icons_41.png'),
                               "Run Dask", self.runDask)
        self.leftwidget.run.setMenu(self.runmenu)
        self.leftwidget.run.clicked.connect(self.runLocal)

        # inject loginwidget
        from xicam.widgets import login
        self.loginwidget = login.LoginDialog()
        self.leftwidget.layout().addWidget(self.loginwidget)

        # SETUP DISPLAY
        display.load()
        display.redraw()
        self.centerwidget.addWidget(display.viewWidget)

        super(HipGISAXSPlugin, self).__init__(*args, **kwargs)
Example #4
0
 def is_Okay(self, text_after, is_y):
     if not ((text_after.isdigit() and int(text_after) <= 500)
             or text_after == ""):
         return False
     if self.loaded:
         if is_y == "isy":
             x, y = self.entry_x.get(), text_after
         else:
             x, y = text_after, self.entry_y.get()
         if x == "":
             x = "1"
         if y == "":
             y = "1"
         display.load([(display.new_window_canvas_id, self.canvas_pic)],
                      self.picture_file, max(1, int(x)), max(1, int(y)))
     return True
Example #5
0
    def __init__(self, app):
        self.app = app

        ui.loadUi()

        # INIT FORMS
        self.computationForm = None
        self._detectorForm = None
        self._scatteringForm = None

        # STYLE
        self.app.setStyle('Plastique')
        with open('xicam/gui/style.stylesheet', 'r') as f:
            self.app.setStyleSheet(f.read())

        # SETUP FEATURES
        featuremanager.layout = ui.mainwindow.featuresList
        featuremanager.load()

        # INIT EXPERIMENT
        self.newExperiment()

        # WIREUP CONTROLS
        ui.mainwindow.addFeatureButton.clicked.connect(featuremanager.addLayer)
        ui.mainwindow.addSubstrateButton.clicked.connect(
            featuremanager.addSubstrate)
        ui.mainwindow.addParticleButton.clicked.connect(
            featuremanager.addParticle)
        ui.mainwindow.showScatteringButton.clicked.connect(self.showScattering)
        ui.mainwindow.showComp50utationButton.clicked.connect(
            self.showComputation)
        ui.mainwindow.showDetectorButton.clicked.connect(self.showDetector)
        ui.mainwindow.addParticleButton.setMenu(ui.particlemenu)
        ui.mainwindow.runLocal.clicked.connect(self.runLocal)

        # SETUP DISPLAY
        display.load()
        ui.mainwindow.latticeplaceholder.addWidget(display.viewWidget)

        # END
        ui.mainwindow.show()
        ui.mainwindow.raise_()
Example #6
0
 def __init__(self, x, y):
     super(player, self).__init__(x, y)
     self.spritesheet = display.load("human_base.png")
     self.mapping = {
         "up": createTupleList(0),
         "right": createTupleList(18),
         "down": createTupleList(36),
         "left": createTupleList(54)
     }
     self.facing = "down"
     self.speed = .5
     self.moving = False
     self.mask = pygame.mask.Mask((16, 16))
Example #7
0
 def load(self, json_file):
     #if thread is running dump it into (old) .json_file and exit it
     #read (new) .json_file
     #load the two canvasses
     #update table content
     self.current_step = -1
     self.tframe.destroy()
     self.place_table()
     self.json_file = json_file
     (self.nailsx, self.nailsy, self.steps_done, self.two_sided_nail,
      self.color_scheme, self.steps,
      self.picture_file) = json_read_write.read_json(json_file)
     self.start_daemon()
     self.reload_table(0)
     self.table.setSelectedRow(-1)
     display.load([(0, self.canvas_pic), (1, self.canvas_pos)],
                  self.picture_file, self.nailsx, self.nailsy)
     for button in [
             self.start_button, self.back_button, self.play_button,
             self.end_button
     ]:
         button.config(state=tk.ACTIVE)
Example #8
0
def main(aType, interval):
	world = logic.loadWorld(aType)
	display.load(iterateStep)