Esempio n. 1
0
    def __init__(self, parsed_args, *args, **kwargs):
        self.parsed_args = parsed_args

        # Create a Leap controller and a listener
        self.controller = Controller()
        self.listener = self.CURSOR_CHOICES[self.parsed_args.mode]()

        self.listener.click_timeout = self.parsed_args.click
        self.listener.press_timeout = self.parsed_args.press
Esempio n. 2
0
	def __init__ (self):
		QMainWindow.__init__ (self)

		self.controller = Controller ()
		self.listener = LeapListener (self)
		self.controller.add_listener (self.listener)

		self.mode = "gallery"
		self.scroll = False
		self.direction = ""
		self.direction_x = 0
		self.scroll_velocity = 0
		self.current_index = 0

		# List containing images for the gallery
		self.list_view = QListWidget ()
		self.list_view.setFlow (0)
		self.list_view.setHorizontalScrollMode (1)
		self.list_view.setMouseTracking (True)
		self.list_view.itemClicked.connect (self.show_image)

		# Setting the style of the ListView, background, item selected, etc
		self.list_view.setStyleSheet ("""
				QListWidget::item:hover {background: transparent;}
				QListWidget::item:disabled:hover {background: transparent;}
				QListWidget::item:hover:!active {background: transparent;}
				QListWidget::item:selected:active {background: transparent;}
	            QListWidget::item:selected:!active {background: transparent;}
	            QListWidget::item:selected:disabled {background: transparent;}
	            QListWidget::item:selected:!disabled {background: transparent;}
	            QListWidget {background: #2C3539}
			""")

		# Image viewer
		self.scene = QGraphicsScene ()
		self.viewer = QGraphicsView (self.scene)

		self.stackedWidget = QStackedWidget ()
		self.stackedWidget.addWidget (self.list_view)
		self.stackedWidget.addWidget (self.viewer)

		self.setCentralWidget (self.stackedWidget)
		self.resize (500, 400)
		self.showMaximized ()

		scan = ScanLibrary ("/home/chris/Example")
		threads.append (scan)
		self.connect (scan, SIGNAL (scan.signal), self.add_images_to_list)
		scan.start ()

		self.connect (self, SIGNAL ("scrollChanged(bool)"), self.scroll_view)
Esempio n. 3
0
    def __init__(self, parser, rate):
        Application.__init__(self, parser)
        self.balls = []
        self.rate = Rate(rate)

        def rand():
            return choice([-1, 1]) * uniform(1. / rate, 10. / rate)

        for ball in range(4):
            self.balls.append(
                Ball(ball, randint(0, self.height - 1),
                     randint(0, self.width - 1), self.height, self.width,
                     Ball.colors[ball % len(Ball.colors)], rand(), rand()))

        # Motion control via Leap Motion
        self.swipe = [None]
        self.swipe_lock = RLock()

        if leapmotion:
            self.leap_listener = SampleListener(self.swipe, self.swipe_lock)
            self.controller = Controller()
            self.controller.add_listener(self.leap_listener)