Skip to content

Instantly share code, notes, and snippets.

@shadeslayer
Created January 29, 2013 12:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shadeslayer/4663893 to your computer and use it in GitHub Desktop.
Save shadeslayer/4663893 to your computer and use it in GitHub Desktop.
import sys
from PyQt4 import uic
from PyQt4 import QtCore, QtGui
from PyKDE4.phonon import *
from PyKDE4.kdecore import *
FaceDirPath = KGlobal.dirs().resourceDirs("data")[-1] + "kdm/pics/users/"
FacesDir = QtCore.QDir(FaceDirPath)
Faces = FacesDir.entryList(QtCore.QDir.Files)
app = QtGui.QApplication(sys.argv)
widgets = uic.loadUi('/tmp/webCam.ui')
for Face in Faces:
QtGui.QListWidgetItem( QtGui.QIcon(FaceDirPath + Face) , Face.replace('.png', ''), widgets.m_FacesWidget)
vbox = widgets.verticalLayout
vp = Phonon.VideoPlayer()
media = Phonon.MediaSource(Phonon.BackendCapabilities.availableVideoCaptureDevices()[0])
vp.load(media)
vbox.addWidget(vp)
PushButton = QtGui.QPushButton("Take a picture!")
vbox.addWidget(PushButton)
vp.play()
widgets.show()
app.exec_()
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>704</width>
<height>477</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>691</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>This picture will identify you in the account settings, login screen, and lock screen.</string>
</property>
</widget>
<widget class="QWidget" name="horizontalLayoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>691</width>
<height>351</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QWidget" name="widget" native="true">
<widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>390</x>
<y>20</y>
<width>281</width>
<height>311</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout"/>
</widget>
<widget class="QListWidget" name="m_FacesWidget">
<property name="geometry">
<rect>
<x>9</x>
<y>16</y>
<width>371</width>
<height>321</height>
</rect>
</property>
<property name="iconSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="resizeMode">
<enum>QListView::Adjust</enum>
</property>
<property name="viewMode">
<enum>QListView::IconMode</enum>
</property>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<connections/>
</ui>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment