Example #1
0
 def __init__(self, thread, position):
     self.thread = thread
     self.config = {}
     #if position == 'even':
     #  self.config['position'] = 'even'
     self.position = position
     self.camera = None
     self.serial = None
     self.code = camera_thread.COMPLETE
     self.message = 'Lost Connection to Camera'
     self.raw = None
     self.filename = None
     self.preview = preview.Preview()
Example #2
0
 def __init__(self):
     QMainWindow.__init__(self, None)
     self.selectionChanged.connect(self.updateTable)
     vsplitter = QSplitter(self)
     vsplitter.setOrientation(Qt.Vertical)
     mytimelinearea = TimelineArea(vsplitter)
     mytimelinearea.setWidget(timeline.Timeline(mytimelinearea, movie))
     hsplitter = QSplitter(vsplitter)
     mypreviewarea = QScrollArea(hsplitter)
     mypreviewarea.setWidget(preview.Preview(mypreviewarea, movie))
     self.info = QTreeWidget(hsplitter)
     self.info.setColumnCount(2)
     self.info.setHeaderLabels(["Name", "Value"])
     vsplitter.addWidget(mytimelinearea)
     vsplitter.addWidget(hsplitter)
     hsplitter.addWidget(self.info)
     hsplitter.addWidget(mypreviewarea)
     self.setCentralWidget(vsplitter)
     self.updateTable()
Example #3
0
    def get_name(self, x, y):
        print(x, y)
        col = x + 1
        row = y + 1

        trows = self.f_rows // 6
        if col == 1:
            ind = row
        if col == 2:
            ind = trows * 1 + row
        if col == 3:
            ind = trows * 2 + row
        if col == 4:
            ind = trows * 3 + row
        if col == 5:
            ind = trows * 4 + row
        if col == 6:
            ind = trows * 5 + row

        location = self.gat[ind - 1]
        prev_location = preview.Preview(location)
Example #4
0
 def __init__(self, manager, **kwargs):
     super(BoxLayoutTabCreation, self).__init__(**kwargs)
     self.orientation = "vertical"
     self.section_name = "None"
     self.toolbox = toolbox_instructions.BoxLayoutToolBox()
     self.toolbox2 = tab_creation_toolbox.BoxLayoutToolBox2(manager=manager)
     self.preview = preview.Preview(manager=manager, pos_hint={"y": .5})
     self.fretboard = toggle_button_fretboard.ToggleButtonLayout(
         preview_array=self.toolbox,
         preview_access=self.preview,
         pos_hint={"y": .5})
     self.hold = ""
     self.section_holder = []
     self.manager = manager
     self.dropdown_menu = dropdown_menu.DropDownMainMenu(
         manager=self.manager)
     self.text_label_array = 0
     self.switch_standard_12 = True
     self.add_widget(self.dropdown_menu.button_main)
     self.add_widget(self.toolbox)
     self.add_widget(self.toolbox2)
     self.add_widget(self.fretboard)
     self.add_widget(self.preview)
Example #5
0
    def __init__(self, working_dir):
        Gtk.Window.__init__(self)
        self.connect('destroy', self.destroy_cb)
        self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
        self.set_resizable(False)

        self.set_title(working_dir)
        os.chdir(working_dir)

        self.stage = next(discover_stages(), None)

        if self.stage is None:
            sys.exit("unable to locate THORLABS stage")

        self.focus_window = None
        self.config_window = None

        self.capture_selection = None
        self.capture_position = None
        self.capture_location = None

        # used to normalise start and end times
        self.capture_start_pos = None
        self.capture_start_time = None

        # queue for image saving to not compromise fps
        self.capture_image_queue = queue.Queue()

        self.vbox = Gtk.VBox(False, 0)
        self.add(self.vbox)
        self.vbox.show()

        fixed = Gtk.Fixed()
        self.vbox.pack_start(fixed, False, True, 0)
        fixed.show()

        self.camera = camera.Camera()
        self.preview = preview.Preview(self.camera)
        fixed.put(self.preview, 0, 0)
        self.preview.show()

        eb = Gtk.EventBox()
        fixed.put(eb, 0, 0)
        eb.show()

        self.progress = progress.Progress()
        self.progress.set_size_request(preview_width, -1)
        eb.add(self.progress)

        eb = Gtk.EventBox()
        fixed.put(eb, 0, 0)
        eb.show()

        self.info = info.Info()
        self.info.set_size_request(preview_width, -1)
        eb.add(self.info)

        self.toolbar = Gtk.HBox(False, 5)
        self.toolbar.set_border_width(3)
        self.vbox.pack_end(self.toolbar, False, False, 0)
        self.toolbar.show()

        button = Gtk.Button()
        quit_image = Gtk.Image.new_from_stock(Gtk.STOCK_QUIT,
                                              Gtk.IconSize.SMALL_TOOLBAR)
        quit_image.show()
        button.set_tooltip_text("Quit RTIAcquire")
        button.connect('clicked', self.destroy_cb, None)
        button.add(quit_image)
        self.toolbar.pack_end(button, False, False, 0)
        button.show()

        button = Gtk.Button()
        menu_image = Gtk.Image.new_from_stock(Gtk.STOCK_PREFERENCES,
                                              Gtk.IconSize.SMALL_TOOLBAR)
        menu_image.show()
        button.set_tooltip_text("Camera settings")
        button.connect('clicked', self.config_cb, None)
        button.add(menu_image)
        self.toolbar.pack_end(button, False, False, 0)
        button.show()

        label = Gtk.Label()
        self.toolbar.pack_end(label, False, False, 0)
        self.preview.score_label = label
        label.show()

        spinner = Gtk.SpinButton.new_with_range(1, 4, 0.1)
        spinner.set_tooltip_text("Maximum velocity of turntable")
        spinner.set_value(self.stage.max_velocity)
        self.toolbar.pack_start(spinner, False, False, 0)
        self.max_velocity = spinner
        spinner.show()

        entry = Gtk.Entry.new()
        entry.set_tooltip_text("Seal name")
        entry.set_placeholder_text("Name of Seal")
        self.toolbar.pack_start(entry, False, False, 0)
        self.seal_name = entry
        entry.show()

        radio = Gtk.RadioButton.new_with_label(None, "Direct LED")
        self.direct_led = radio
        self.toolbar.pack_start(radio, False, False, 0)
        radio.show()

        radio = Gtk.RadioButton.new_with_label_from_widget(
            radio, "Structured Light")
        self.toolbar.pack_start(radio, False, False, 0)
        radio.show()

        button = Gtk.Button("Start Capture")
        button.set_tooltip_text("Start seal capture")
        button.connect('clicked', self.capture_cb, None)
        self.toolbar.pack_start(button, False, False, 0)
        self.capture = button
        button.show()

        self.info.msg('Something Something Something', 'v0.1, July 2017')
        self.progress.progress(0.2)

        self.preview.set_live(True)

        self.show()
Example #6
0
    def __init__(self):
        gtk.Window.__init__(self)
        self.connect('destroy', self.destroy_cb)

        self.config_window = None
        self.live_hide_timeout = 0
        self.light_hop_timeout = 0
        self.busy = False

        self.leds = ledmap.Ledmap(os.path.join(source_dir, 'data', 
                                               'led-maps.txt'))

        logging.debug('loaded %d maps', len(self.leds.get_names()))
        for name in self.leds.get_names():
            bytes = self.leds.get_bytes(name)
            logging.debug('%s: %d lights', name, len(bytes))

        # where project directories get written, see RTI cap above
        self.outdir = options.outdir

        self.lights = lights.Lights()

        # try to reset the lights ... if this fails, disable dome controls
        try:
            self.dome_controls = True
            name = self.leds.get_names()[0]
            self.lights.set_triple(self.leds.get_bytes(name)[0])
        except lights.Error as e:
            logging.debug('no lights found, disabling dome controls')
            self.dome_controls = False

        self.vbox = gtk.VBox(False, 0)
        self.add(self.vbox)
        self.vbox.show()

        fixed = gtk.Fixed()
        self.vbox.pack_start(fixed, False)
        fixed.show()

        self.camera = camera.Camera()
        self.preview = preview.Preview(self.camera)
        fixed.put(self.preview, 0, 0)
        self.preview.show()
        self.preview.connect('motion_notify_event', self.preview_motion_cb)

        if options.verbose:
            try:
                config = camera.Config(self.camera) 
                config.prettyprint(sys.stdout, config.get_root_widget())
            except:
                logging.debug("No Camera detected: unable to print config")
        eb = gtk.EventBox()
        fixed.put(eb, 0, 0)
        eb.show()

        self.progress = progress.Progress()
        self.progress.set_size_request(preview_width, -1)
        eb.add(self.progress)

        eb = gtk.EventBox()
        fixed.put(eb, 0, 0)
        eb.show()

        self.info = info.Info()
        self.info.set_size_request(preview_width, -1)
        eb.add(self.info)

        eb = gtk.EventBox()
        fixed.put(eb, 20, 380)
        eb.show()

        self.play_image = gtk.image_new_from_stock(gtk.STOCK_MEDIA_PLAY, 
                        gtk.ICON_SIZE_SMALL_TOOLBAR)
        self.pause_image = gtk.image_new_from_stock(gtk.STOCK_MEDIA_PAUSE, 
                        gtk.ICON_SIZE_SMALL_TOOLBAR)
        self.live = gtk.Button()
        self.live.set_image(self.play_image)
        self.live.set_tooltip_text("Start/stop live preview")
        self.live.connect('clicked', self.live_cb, None)
        eb.add(self.live)
        self.live.show()

        self.toolbar = gtk.HBox(False, 5)
        self.toolbar.set_border_width(3)
        self.vbox.pack_end(self.toolbar)
        self.toolbar.show()

        button = gtk.Button()
        quit_image = gtk.image_new_from_stock(gtk.STOCK_QUIT, 
                        gtk.ICON_SIZE_SMALL_TOOLBAR)
        quit_image.show()
        button.set_tooltip_text("Quit RTIAcquire")
        button.connect('clicked', self.destroy_cb, None)
        button.add(quit_image)
        self.toolbar.pack_end(button, False, False)
        button.show()

        if self.dome_controls:
            self.dome_picker = gtk.combo_box_new_text()
            for name in self.leds.get_names():
                self.dome_picker.append_text(name)
            self.dome_picker.set_active(0)
            self.dome_picker.set_tooltip_text("Select lighting system")
            self.dome_picker.connect('changed', self.dome_picker_cb, None)
            self.toolbar.pack_start(self.dome_picker, False, False)
            self.dome_picker.show()

            self.light_picker = gtk.SpinButton(climb_rate = 1)
            self.light_picker.set_numeric(True)
            self.light_picker.set_wrap(True)
            self.light_picker.set_increments(1, 1)
            self.light_picker.set_tooltip_text("Pick light")
            self.light_picker_refresh()
            self.light_picker.connect('value_changed', 
                    self.light_picker_cb, None)
            self.toolbar.pack_start(self.light_picker, False, False)
            self.light_picker.show()

        button = gtk.Button()
        menu_image = gtk.image_new_from_stock(gtk.STOCK_PREFERENCES, 
                        gtk.ICON_SIZE_SMALL_TOOLBAR)
        menu_image.show()
        button.set_tooltip_text("Camera settings")
        button.connect('clicked', self.config_cb, None)
        button.add(menu_image)
        self.toolbar.pack_start(button, False, False)
        button.show()

        button = gtk.Button('Focus')
        button.set_tooltip_text("Focus camera automatically")
        button.connect('clicked', self.focus_cb, None)
        self.toolbar.pack_start(button, False, False)
        button.show()

        photo_image = gtk.image_new_from_file(
                os.path.join(source_dir, 'data', 'camera_24.png'))
        photo = gtk.Button()
        photo.set_image(photo_image)
        photo.set_tooltip_text("Take single photo")
        photo.connect('clicked', self.photo_cb, None)
        self.toolbar.pack_start(photo, False, False)
        photo.show()

        if self.dome_controls:
            photo = gtk.Button('RTI Preview')
            photo.set_tooltip_text("Take preview RTI image")
            photo.connect('clicked', self.rti_preview_cb, None)
            self.toolbar.pack_start(photo, False, False)
            photo.show()

            photo = gtk.Button('RTI Capture ...')
            photo.set_tooltip_text("Start full RTI acquisition")
            photo.connect('clicked', self.rti_capture_cb, None)
            self.toolbar.pack_start(photo, False, False)
            photo.show()

        self.info.msg('Welcome to RTI Acquire', 'v1.3, March 2014')

        self.show()
Example #7
0
 def rem_get_name(self, ind, ex):
     rem_location = self.gat[ex + ind]
     openprev = preview.Preview(rem_location)
Example #8
0
 def rem_get_name(self, ind, ex):
     print(ex + ind + 1)
     rem_location = self.gat[ex + ind]
     print(rem_location)
     p2=preview.Preview(rem_location)