Пример #1
0
	def __init__(self, parent, module):
		super(ModuleInfo, self).__init__(parent, title=_("Book Information"), 
			style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)

		panel = wx.Panel(self)

		# XXX: Make the sunken border style work?
		info_frame = DisplayFrame(panel)
		info_frame.mod = module
		info_sizer = wx.BoxSizer(wx.HORIZONTAL)
		info_sizer.Add(info_frame, 1, wx.GROW)
		panel.SetSizer(info_sizer)

		# it's not in our usual book hierarchy, we have to supply a module
		info_frame.OpenURI(protocol_handlers.ModuleInformationHandlerModule.register(module))
		
		# now put the OK button on
		b = wx.Button(self, id=wx.ID_OK)
		s = wx.StdDialogButtonSizer()
		s.AddButton(b)
		s.Realize()

		sizer = wx.BoxSizer(wx.VERTICAL)
		sizer.Add(panel, 1, wx.GROW|wx.ALL, 10)
		sizer.Add(s, 0, wx.GROW|wx.ALL, 6)
		self.SetSizerAndFit(sizer)
		# XXX: Make sizing work properly later.
		self.Size = (600, 500)
Пример #2
0
def on_bpbible_click(frame, href, url):
	from displayframe import DisplayFrame
	href_and_url = find_passage_study_url(href)
	if href_and_url:
		DisplayFrame.on_link_clicked(frame, href_and_url[0], href_and_url[1])
Пример #3
0
def on_bpbible_hover(frame, href, url, element, x, y):
	from displayframe import DisplayFrame
	href_and_url = find_passage_study_url(href)
	if href_and_url:
		DisplayFrame.on_hover(frame, href_and_url[0], href_and_url[1], element, x, y)
Пример #4
0
# set video resolution
resWidth = 320
resLength = 240

if not args.get("video", False):
    #test
    vs = VideoStream(usePiCamera=True,
                     awb_mode='sunlight',
                     resolution=(resWidth, resLength))
    vs.start()  # awb_mode=sunlight works well for tracking green object
    print("cam warming up")
    time.sleep(1)
    tracker1 = ColorTracker(vs.mainQueue)
    tracker1.start()
    # tracker2 = ColorTracker(vs.mainQueue).start()
    # hud = Hud()
    # hud.start(tracker.cnts)
    # time.sleep(1)
    df1 = DisplayFrame(tracker1.xyDoneQueue)
    df1.start()
    # df2 = DisplayFrame(tracker2.xyDoneQueue).start()

    vs.join()
    tracker1.join()
    df1.join()

# vs.release()

## close all windows
# cv2.destroyAllWindows()
Пример #5
0
def on_bpbible_click(frame, href, url):
    from displayframe import DisplayFrame
    href_and_url = find_passage_study_url(href)
    if href_and_url:
        DisplayFrame.on_link_clicked(frame, href_and_url[0], href_and_url[1])
Пример #6
0
def on_bpbible_hover(frame, href, url, element, x, y):
    from displayframe import DisplayFrame
    href_and_url = find_passage_study_url(href)
    if href_and_url:
        DisplayFrame.on_hover(frame, href_and_url[0], href_and_url[1], element,
                              x, y)
Пример #7
0
# set video resolution
resWidth = 320
resLength = 240

if not args.get("video", False):
    #test
    vs = VideoStream(
        usePiCamera=True,
        awb_mode='sunlight',
        resolution=(resWidth, resLength)).start(
        )  # awb_mode=sunlight works well for tracking green object
    print("cam warming up")
    time.sleep(1)
    tracker1 = ColorTracker(vs.mainQueue).start()
    # tracker2 = ColorTracker(vs.mainQueue).start()
    # hud = Hud()
    # hud.start(tracker.cnts)
    # time.sleep(1)
    df1 = DisplayFrame(tracker1.xyDoneQueue).start()
    # df2 = DisplayFrame(tracker2.xyDoneQueue).start()

    vs.t.join()
    tracker1.t.join()
    df1.t.join()

# vs.release()

## close all windows
# cv2.destroyAllWindows()
Пример #8
0
def main():
    # create queues in shared memory so each process can access it
    mainQueue = Queue(maxsize=70)
    xyDoneQueue = Queue(maxsize=70)
    hudDoneQueue = Queue(maxsize=70)
    resizeDoneQueue = Queue(maxsize=70)

    # start VideoStream process
    vs = PiVideoStream(mainQueue, file1)
    time.sleep(1)  # allow pi camera to "warm up"
    vsP1 = Process(target=vs.update,
                   name='videoStreamProcess',
                   args=(resolution, framerate,
                         awb_mode))  # passing these parameters here because
    time.sleep(
        0.5
    )  # put some frames into mainQueue to stop other processes from throwing errors
    # passing to PiVideoStream instantiation causes pi camera to be accessed by two different processes which breaks it
    vsP1.daemon = True
    vsP1.start()

    # start ColorTracker process
    tracker = ColorTracker(mainQueue, xyDoneQueue, file2)  # pass shared queues
    trackerP1 = Process(target=tracker.update, name='trackerProcess', args=())
    trackerP1.daemon = True
    trackerP1.start()

    # start Hud process
    hud = Hud(resolution, xyDoneQueue, hudDoneQueue, file3, hud_done)
    hudP1 = Process(target=hud.draw, name='hudProcess', args=())
    hudP1.daemon = True
    hudP1.start()

    # start ResizeFrame process 1
    resize = ResizeFrame(hudDoneQueue,
                         resizeDoneQueue,
                         file4,
                         hud_done,
                         instance_name='resizer1')
    resizeP1 = Process(target=resize.resize, name='resizeProcess', args=())
    resizeP1.daemon = True
    resizeP1.start()

    # start ResizeFrame process 2
    resize2 = ResizeFrame(hudDoneQueue,
                          resizeDoneQueue,
                          file4B,
                          hud_done,
                          instance_name='resizer2')
    resizeP2 = Process(target=resize2.resize, name='resizeProcess2', args=())
    resizeP2.daemon = True
    resizeP2.start()

    # start DisplayFrame process
    display = DisplayFrame(resizeDoneQueue, file5, done)
    displayP1 = Process(target=display.show, name='displayProcess', args=())
    displayP1.daemon = True
    displayP1.start()

    while not done.is_set():
        continue

    else:
        print('Terminating processes')
        file1.close()
        file2.close()
        file3.close()
        file4.close()
        file4B.close()
        vsP1.terminate()
        trackerP1.terminate()
        hudP1.terminate()
        resizeP1.terminate()
        resizeP2.terminate()
        displayP1.terminate()