├── AutoQObject.py ├── CarAnalogy.py ├── CarAnalogy.qml ├── Constants.py ├── Constants.qml ├── Cool.qml ├── ImageProvider.py ├── ImageProvider.qml ├── ListAsList.py ├── ListAsList.qml ├── MultiList.py ├── MultiList.qml ├── MultiListAnim.py ├── MultiListAnim.qml ├── MyProgressBar.qml ├── PythonList.py ├── PythonList.qml ├── Translucent.py ├── Translucent.qml ├── UnderMeSensi.py ├── UnderMeSensi.qml ├── WebKitView.html ├── WebKitView.py ├── WebKitView.qml ├── WorkingOnIt-colibri.qml ├── WorkingOnIt.py ├── WorkingOnIt.qml ├── call_javascript_from_python.py ├── call_javascript_from_python.qml ├── colibri ├── CLButton.qml ├── CLCarousel.qml ├── CLCheckBox.qml ├── CLComboBox.qml ├── CLDatePicker.qml ├── CLDial.qml ├── CLHistogram.qml ├── CLKeyboard.qml ├── CLLayer.qml ├── CLLineEdit.qml ├── CLListbox.qml ├── CLProgressBar.qml ├── CLRating.qml ├── CLScrollBar.qml ├── CLScrollBarVertical.qml ├── CLSlider.qml ├── CLSliderVertical.qml ├── CLStyle.qml ├── CLTab.qml ├── CLTextArea.qml ├── gradients │ ├── Blue.qml │ ├── Grey.qml │ ├── LightBlue.qml │ └── Red.qml ├── images │ ├── arrow_down_50x50.png │ ├── arrow_left_50x50.png │ ├── arrow_right_50x50.png │ ├── arrow_up_50x50.png │ ├── backspace_50x70.png │ ├── calendar_icon.png │ ├── cover1.jpg │ ├── cover2.jpg │ ├── cover3.jpg │ ├── cover4.jpg │ ├── cover5.jpg │ ├── cover6.jpg │ ├── cover7.jpg │ ├── cover8.jpg │ ├── delete_50x50.png │ ├── enter_50x70.png │ ├── lock_closed_web.png │ ├── lock_open_web.png │ ├── logo.jpg │ ├── logo_transparent.png │ ├── logo_transparent2.png │ ├── ok_50x50.png │ ├── shift_50x50.png │ ├── star_off.png │ ├── star_on.png │ ├── tab.png │ └── tick.png ├── includes │ ├── Fruits.qml │ ├── HistogramColumn.qml │ ├── KeyboardButton.qml │ ├── RatingStar.qml │ ├── Screen.qml │ ├── TestCoverList.qml │ └── TestItemList.qml └── javascripts │ ├── date.js │ ├── datepicker.js │ ├── functions.js │ ├── histogram.js │ ├── histogram2.js │ └── keyboard.js ├── images ├── pyside-rounded-corners.png └── pysidelogo.png ├── list_data_model.py ├── list_data_model.qml ├── meego12-guishell ├── README ├── pyside.png ├── pyside.py ├── pyside.qml └── pysidee.desktop ├── pdf ├── Auto-generating_QObject_from_template_in_PySide.pdf ├── Defining_and_using_constants_from_PySide_in_QML.pdf ├── Filling_and_reading_QML_UI_forms_from_Python.pdf ├── Multi-selection_lists_in_Python_with_QML.pdf ├── Selectable_list_of_Python_objects_in_QML.pdf ├── Updating_QML_content_from_Python_threads.pdf ├── Using_QtMobility_sensors_and_QML_from_PySide.pdf ├── Using_QtWebKit_and_QML_with_PySide.pdf ├── Utilizing_Qt_Quick_Colibri_in_PySide.pdf ├── articles.txt └── download.py ├── qml_python_dict.py └── qml_python_dict.qml /AutoQObject.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from PySide import QtCore 4 | 5 | def AutoQObject(*class_def, **kwargs): 6 | class Object(QtCore.QObject): 7 | def __init__(self, **kwargs): 8 | QtCore.QObject.__init__(self) 9 | for key, val in class_def: 10 | self.__dict__['_'+key] = kwargs.get(key, val()) 11 | 12 | def __repr__(self): 13 | values = ('%s=%r' % (key, self.__dict__['_'+key]) \ 14 | for key, value in class_def) 15 | return '<%s (%s)>' % (kwargs.get('name', 'QObject'), ', '.join(values)) 16 | 17 | for key, value in class_def: 18 | nfy = locals()['_nfy_'+key] = QtCore.Signal() 19 | 20 | def _get(key): 21 | def f(self): 22 | return self.__dict__['_'+key] 23 | return f 24 | 25 | def _set(key): 26 | def f(self, value): 27 | self.__dict__['_'+key] = value 28 | self.__dict__['_nfy_'+key].emit() 29 | return f 30 | 31 | set = locals()['_set_'+key] = _set(key) 32 | get = locals()['_get_'+key] = _get(key) 33 | 34 | locals()[key] = QtCore.Property(value, get, set, notify=nfy) 35 | 36 | return Object 37 | 38 | Car = AutoQObject( 39 | ('model', str), 40 | ('brand', str), 41 | ('year', int), 42 | ('inStock', bool), 43 | name='Car' 44 | ) 45 | 46 | print Car 47 | 48 | c = Car(model='Fiesta', brand='Ford', year=1337) 49 | print c.model, c.brand, c.year, c.inStock 50 | print c 51 | 52 | c.inStock = True 53 | 54 | print c.model, c.brand, c.year, c.inStock 55 | print c 56 | 57 | 58 | -------------------------------------------------------------------------------- /CarAnalogy.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import sys 4 | 5 | from PySide import QtCore, QtGui, QtDeclarative 6 | 7 | class Car(QtCore.QObject): 8 | def __init__(self, model='', brand='', year=0, in_stock=False): 9 | QtCore.QObject.__init__(self) 10 | self.__model = model 11 | self.__brand = brand 12 | self.__year = year 13 | self.__in_stock = in_stock 14 | 15 | changed = QtCore.Signal() 16 | 17 | def _model(self): return self.__model 18 | def _brand(self): return self.__brand 19 | def _year(self): return self.__year 20 | def _inStock(self): return self.__in_stock 21 | 22 | def _setModel(self, model): 23 | self.__model = model 24 | self.changed.emit() 25 | 26 | def _setBrand(self, brand): 27 | self.__brand = brand 28 | self.changed.emit() 29 | 30 | def _setYear(self, year): 31 | self.__year = year 32 | self.changed.emit() 33 | 34 | def _setInStock(self, in_stock): 35 | self.__in_stock = in_stock 36 | self.changed.emit() 37 | 38 | model = QtCore.Property(str, _model, _setModel, notify=changed) 39 | brand = QtCore.Property(str, _brand, _setBrand, notify=changed) 40 | year = QtCore.Property(int, _year, _setYear, notify=changed) 41 | inStock = QtCore.Property(bool, _inStock, _setInStock, notify=changed) 42 | 43 | 44 | class Controller(QtCore.QObject): 45 | def __init__(self, lst): 46 | QtCore.QObject.__init__(self) 47 | self._lst = lst 48 | self._pos = 0 49 | 50 | def fill(self, widgets): 51 | widgets['model'].setProperty('text', self._lst[self._pos].model) 52 | widgets['brand'].setProperty('text', self._lst[self._pos].brand) 53 | widgets['year'].setProperty('value', self._lst[self._pos].year) 54 | widgets['inStock'].setProperty('checked', self._lst[self._pos].inStock) 55 | widgets['position'].setProperty('text', '%d/%d' % (self._pos+1, len(self._lst))) 56 | 57 | @QtCore.Slot(QtCore.QObject) 58 | def prev(self, root): 59 | print 'prev' 60 | self._pos = max(0, self._pos - 1) 61 | self.fill(root.property('widgets')) 62 | 63 | @QtCore.Slot(QtCore.QObject) 64 | def next(self, root): 65 | print 'next' 66 | self._pos = min(len(self._lst) - 1, self._pos + 1) 67 | self.fill(root.property('widgets')) 68 | 69 | @QtCore.Slot(QtCore.QObject) 70 | def init(self, root): 71 | print 'init' 72 | self.fill(root.property('widgets')) 73 | 74 | cars = [ 75 | Car('Model T', 'Ford', 1908), 76 | Car('Beetle', 'Volkswagen', 1938, True), 77 | Car('Corolla', 'Toyota', 1966), 78 | Car('Clio', 'Renault', 1991, True), 79 | Car('Ambassador', 'Hindustan', 1958), 80 | Car('Uno', 'Fiat', 1983, True), 81 | Car('Ibiza', 'Seat', 1984, True), 82 | ] 83 | 84 | controller = Controller(cars) 85 | 86 | app = QtGui.QApplication(sys.argv) 87 | 88 | view = QtDeclarative.QDeclarativeView() 89 | view.setResizeMode(QtDeclarative.QDeclarativeView.SizeRootObjectToView) 90 | 91 | ctx = view.rootContext() 92 | 93 | for name in ('controller', 'cars'): 94 | ctx.setContextProperty(name, locals()[name]) 95 | 96 | view.setSource(__file__.replace('.py', '.qml')) 97 | view.show() 98 | 99 | app.exec_() 100 | 101 | -------------------------------------------------------------------------------- /CarAnalogy.qml: -------------------------------------------------------------------------------- 1 | 2 | import Qt 4.7 3 | import "colibri" 4 | 5 | Rectangle { 6 | id: page 7 | 8 | property variant widgets 9 | 10 | width: 800 11 | height: 480 12 | 13 | Grid { 14 | id: grid 15 | columns: 2 16 | anchors.centerIn: parent 17 | spacing: 10 18 | 19 | Row { 20 | CLButton { text: "←"; onClicked: { controller.prev(page) } } 21 | CLButton { text: "→"; onClicked: { controller.next(page) } } 22 | } 23 | 24 | Text { id: position; text: " " } 25 | 26 | Text { text: "Model:" } 27 | 28 | CLLineEdit { id: model } 29 | 30 | Text { text: "Brand:" } 31 | 32 | CLLineEdit { id: brand } 33 | 34 | Text { text: "Year:" } 35 | 36 | Column { 37 | spacing: 10 38 | CLSlider { 39 | id: year 40 | minimum: 1900 41 | maximum: 2010 42 | } 43 | Text { 44 | text: year.value 45 | } 46 | } 47 | 48 | Text { text: " " } 49 | 50 | Row { 51 | spacing: 10 52 | CLCheckBox { id: inStock } 53 | Text { text: "In Stock" } 54 | } 55 | } 56 | 57 | Component.onCompleted: { 58 | widgets = { 59 | 'position': position, 60 | 'model': model, 61 | 'brand': brand, 62 | 'year': year, 63 | 'inStock': inStock, 64 | } 65 | controller.init(page) 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /Constants.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import sys 4 | 5 | from PySide import QtCore 6 | from PySide import QtGui 7 | from PySide import QtDeclarative 8 | 9 | Constants = { 10 | 'CustomText': "Hey PySide!", 11 | 'FontSize': 9.24, 12 | 'Colors': { 13 | 'Background': "#8ac852", 14 | 'Foreground': "#00672a", 15 | }, 16 | 'BoldText': True, 17 | 'Items': { 18 | 'Count': 7, 19 | 'Suffixes': ['A', 'B', 'C', 'D', 'E', 'F', 'G'], 20 | }, 21 | 'Step': { 'X': 5, 'Y': 10 }, 22 | } 23 | 24 | app = QtGui.QApplication(sys.argv) 25 | 26 | view = QtDeclarative.QDeclarativeView() 27 | view.setResizeMode(QtDeclarative.QDeclarativeView.SizeRootObjectToView) 28 | 29 | ctx = view.rootContext() 30 | ctx.setContextProperty('C', Constants) 31 | 32 | view.setSource('Constants.qml') 33 | view.show() 34 | 35 | sys.exit(app.exec_()) 36 | 37 | -------------------------------------------------------------------------------- /Constants.qml: -------------------------------------------------------------------------------- 1 | 2 | import Qt 4.7 3 | 4 | Rectangle { 5 | width: 400 6 | height: 400 7 | color: C.Colors.Background 8 | 9 | Repeater { 10 | model: C.Items.Count 11 | 12 | Text { 13 | y: index * C.Step.Y 14 | x: index * C.Step.X 15 | color: C.Colors.Foreground 16 | font.bold: C.BoldText 17 | font.pointSize: C.FontSize 18 | text: C.CustomText + C.Items.Suffixes[index] 19 | } 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /Cool.qml: -------------------------------------------------------------------------------- 1 | 2 | import Qt 4.7 3 | 4 | Rectangle { 5 | property string text: "..." 6 | color: "blue" 7 | height: 40 8 | 9 | Text { 10 | text: parent.text 11 | anchors.fill: parent 12 | color: "red" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ImageProvider.py: -------------------------------------------------------------------------------- 1 | 2 | # Custom Image Provider for QML, written in PySide 3 | 4 | from PySide.QtCore import * 5 | from PySide.QtGui import * 6 | from PySide.QtDeclarative import * 7 | 8 | class ImageProvider(QDeclarativeImageProvider): 9 | IMAGE_TYPE = QDeclarativeImageProvider.ImageType.Image 10 | 11 | def __init__(self): 12 | QDeclarativeImageProvider.__init__(self, ImageProvider.IMAGE_TYPE) 13 | 14 | def requestImage(self, id, size, requestedSize): 15 | print 'requestImage:', { 16 | 'id': id, 17 | 'size': size, 18 | 'requestedSize': requestedSize 19 | } 20 | return QImage('images/pysidelogo.png') 21 | 22 | app = QApplication([]) 23 | view = QDeclarativeView() 24 | 25 | provider = ImageProvider() 26 | view.engine().addImageProvider('python', provider) 27 | 28 | view.setSource(__file__.replace('.py', '.qml')) 29 | 30 | view.show() 31 | app.exec_() 32 | 33 | -------------------------------------------------------------------------------- /ImageProvider.qml: -------------------------------------------------------------------------------- 1 | 2 | import Qt 4.7 3 | 4 | Rectangle { 5 | width: 400 6 | height: 200 7 | color: '#ebbe47' 8 | 9 | Image { 10 | anchors.bottom: parent.bottom 11 | anchors.right: parent.right 12 | // This uses the custom ImageProvider defined inside Python: 13 | source: 'image://python/ThisPartIsGivenAsIDToTheImageProvider' 14 | } 15 | 16 | Image { 17 | anchors.top: parent.top 18 | anchors.left: parent.left 19 | source: 'image://python/TheSecondImageIsTheSame' 20 | sourceSize { width: 10; height: 10 } 21 | } 22 | } 23 | 24 | -------------------------------------------------------------------------------- /ListAsList.py: -------------------------------------------------------------------------------- 1 | 2 | from PySide.QtCore import * 3 | from PySide.QtGui import * 4 | from PySide.QtDeclarative import * 5 | 6 | import sys 7 | 8 | app = QApplication(sys.argv) 9 | 10 | class MyObject(QObject): 11 | def __init__(self): 12 | QObject.__init__(self) 13 | 14 | a = MyObject() 15 | b = MyObject() 16 | 17 | pylist = [ 18 | {'a': 1, 'b': 'Two', 'c': 3.3, 'd': a}, 19 | {'a': 11, 'b': 'Two Two', 'c': 6.6, 'd': b}, 20 | ] 21 | 22 | class MyController(QObject): 23 | @Slot(QObject) 24 | def pycallback(self, o): 25 | print 'got:', o 26 | 27 | mycontroller = MyController() 28 | 29 | view = QDeclarativeView() 30 | view.rootContext().setContextProperty('pylist', pylist) 31 | view.rootContext().setContextProperty('mycontroller', mycontroller) 32 | view.setSource(__file__.replace('.py', '.qml')) 33 | view.show() 34 | 35 | sys.exit(app.exec_()) 36 | 37 | -------------------------------------------------------------------------------- /ListAsList.qml: -------------------------------------------------------------------------------- 1 | 2 | import QtQuick 1.1 3 | 4 | ListView { 5 | width: 500 6 | height: 500 7 | model: pylist 8 | delegate: Text { 9 | text: modelData.c 10 | MouseArea { 11 | anchors.fill: parent 12 | onClicked: mycontroller.pycallback(modelData.d) 13 | } 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /MultiList.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | """Click-your-Zen of PySide""" 4 | 5 | import sys 6 | import this 7 | 8 | from PySide import QtCore 9 | from PySide import QtGui 10 | from PySide import QtDeclarative 11 | 12 | class ZenWrapper(QtCore.QObject): 13 | def __init__(self, zenItem): 14 | QtCore.QObject.__init__(self) 15 | self._zenItem = zenItem 16 | self._checked = False 17 | 18 | def _name(self): 19 | return self._zenItem 20 | 21 | def is_checked(self): 22 | return self._checked 23 | 24 | def toggle_checked(self): 25 | self._checked = not self._checked 26 | self.changed.emit() 27 | 28 | changed = QtCore.Signal() 29 | 30 | name = QtCore.Property(unicode, _name, notify=changed) 31 | checked = QtCore.Property(bool, is_checked, notify=changed) 32 | 33 | class ZenListModel(QtCore.QAbstractListModel): 34 | def __init__(self, zenItems): 35 | QtCore.QAbstractListModel.__init__(self) 36 | self._zenItems = zenItems 37 | self.setRoleNames({0: 'zenItem'}) 38 | 39 | def rowCount(self, parent=QtCore.QModelIndex()): 40 | return len(self._zenItems) 41 | 42 | def checked(self): 43 | return [x for x in self._zenItems if x.checked] 44 | 45 | def data(self, index, role): 46 | if index.isValid() and role == 0: 47 | return self._zenItems[index.row()] 48 | 49 | class Controller(QtCore.QObject): 50 | @QtCore.Slot(QtCore.QObject, QtCore.QObject) 51 | def toggled(self, model, wrapper): 52 | global view, __doc__ 53 | wrapper.toggle_checked() 54 | new_list = model.checked() 55 | print '='*20, 'New List', '='*20 56 | print '\n'.join(x.name for x in new_list) 57 | view.setWindowTitle('%s (%d)' % (__doc__, len(new_list))) 58 | 59 | zenItems = [ZenWrapper(zenItem) for zenItem in \ 60 | ''.join([this.d.get(c, c) for c in \ 61 | this.s]).splitlines()[2:]] 62 | 63 | controller = Controller() 64 | zenItemList = ZenListModel(zenItems) 65 | 66 | app = QtGui.QApplication(sys.argv) 67 | 68 | view = QtDeclarative.QDeclarativeView() 69 | view.setWindowTitle(__doc__) 70 | view.setResizeMode(QtDeclarative.QDeclarativeView.SizeRootObjectToView) 71 | 72 | rc = view.rootContext() 73 | 74 | rc.setContextProperty('controller', controller) 75 | rc.setContextProperty('pythonListModel', zenItemList) 76 | view.setSource(__file__.replace('.py', '.qml')) 77 | 78 | view.show() 79 | app.exec_() 80 | 81 | -------------------------------------------------------------------------------- /MultiList.qml: -------------------------------------------------------------------------------- 1 | 2 | import Qt 4.7 3 | 4 | ListView { 5 | id: pythonList 6 | width: 300 7 | height: 500 8 | model: pythonListModel 9 | 10 | delegate: Component { 11 | Rectangle { 12 | width: pythonList.width 13 | height: 30 14 | color: model.zenItem.checked?"#00B8F5":(index%2?"#eee":"#ddd") 15 | Text { 16 | elide: Text.ElideRight 17 | text: model.zenItem.name 18 | color: (model.zenItem.checked?"white":"black") 19 | anchors { 20 | verticalCenter: parent.verticalCenter 21 | left: parent.left 22 | right: (model.zenItem.checked?checkbox.left:parent.right) 23 | leftMargin: 5 24 | } 25 | } 26 | Text { 27 | id: checkbox 28 | text: "✔" 29 | font.pixelSize: parent.height 30 | font.bold: true 31 | visible: model.zenItem.checked 32 | color: "white" 33 | anchors { 34 | verticalCenter: parent.verticalCenter 35 | right: parent.right 36 | rightMargin: 5 37 | } 38 | } 39 | MouseArea { 40 | anchors.fill: parent 41 | onClicked: { controller.toggled(pythonListModel, model.zenItem) } 42 | } 43 | } 44 | } 45 | } 46 | 47 | -------------------------------------------------------------------------------- /MultiListAnim.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | """Animate your code of PySide""" 4 | 5 | import sys 6 | 7 | from PySide import QtCore 8 | from PySide import QtGui 9 | from PySide import QtDeclarative 10 | from PySide import QtOpenGL 11 | 12 | class ZenWrapper(QtCore.QObject): 13 | def __init__(self, zenItem): 14 | QtCore.QObject.__init__(self) 15 | self._zenItem = zenItem 16 | self._checked = False 17 | 18 | def _name(self): 19 | return self._zenItem 20 | 21 | def is_checked(self): 22 | return self._checked 23 | 24 | def toggle_checked(self): 25 | self._checked = not self._checked 26 | self.changed.emit() 27 | return self._checked 28 | 29 | changed = QtCore.Signal() 30 | 31 | name = QtCore.Property(unicode, _name, notify=changed) 32 | checked = QtCore.Property(bool, is_checked, notify=changed) 33 | 34 | class ZenListModel(QtCore.QAbstractListModel): 35 | def __init__(self, zenItems): 36 | QtCore.QAbstractListModel.__init__(self) 37 | self._zenItems = zenItems 38 | self.setRoleNames({0: 'zenItem'}) 39 | 40 | def rowCount(self, parent=QtCore.QModelIndex()): 41 | return len(self._zenItems) 42 | 43 | def checked(self): 44 | return [x for x in self._zenItems if x.checked] 45 | 46 | def data(self, index, role): 47 | if index.isValid() and role == 0: 48 | return self._zenItems[index.row()] 49 | 50 | class Controller(QtCore.QObject): 51 | @QtCore.Slot(QtCore.QObject, QtCore.QObject, QtCore.QObject, QtCore.QObject) 52 | def toggled(self, model, wrapper, checkbox, parent): 53 | global view, __doc__ 54 | new_value = wrapper.toggle_checked() 55 | new_list = model.checked() 56 | print '='*20, 'New List', '='*20 57 | print '\n'.join(x.name for x in new_list) 58 | view.setWindowTitle('%s (%d)' % (__doc__, len(new_list))) 59 | 60 | if new_value: 61 | pa = QtCore.QSequentialAnimationGroup(parent) 62 | anim = QtCore.QPropertyAnimation(checkbox, 'scale') 63 | anim.setDuration(700) 64 | anim.setStartValue(10) 65 | anim.setEndValue(1) 66 | anim.setEasingCurve(QtCore.QEasingCurve.OutSine) 67 | pa.addAnimation(anim) 68 | anim = QtCore.QPropertyAnimation(parent, 'rotation', parent) 69 | anim.setDuration(100) 70 | anim.setStartValue(-180) 71 | anim.setEndValue(0) 72 | pa.addAnimation(anim) 73 | pa.start(QtCore.QAbstractAnimation.DeleteWhenStopped) 74 | 75 | zenItems = [ZenWrapper(zenItem.rstrip()) for zenItem in open(__file__) if zenItem.strip() and not zenItem.startswith(' ')] 76 | 77 | controller = Controller() 78 | zenItemList = ZenListModel(zenItems) 79 | 80 | app = QtGui.QApplication(sys.argv) 81 | 82 | view = QtDeclarative.QDeclarativeView() 83 | glw = QtOpenGL.QGLWidget() 84 | view.setViewport(glw) 85 | view.setWindowTitle(__doc__) 86 | view.setResizeMode(QtDeclarative.QDeclarativeView.SizeRootObjectToView) 87 | 88 | rc = view.rootContext() 89 | 90 | rc.setContextProperty('controller', controller) 91 | rc.setContextProperty('pythonListModel', zenItemList) 92 | view.setSource(__file__.replace('.py', '.qml')) 93 | 94 | view.show() 95 | app.exec_() 96 | 97 | -------------------------------------------------------------------------------- /MultiListAnim.qml: -------------------------------------------------------------------------------- 1 | 2 | import Qt 4.7 3 | import "colibri" 4 | 5 | Rectangle { 6 | width: 300 7 | height: 500 8 | CLSlider { 9 | id: slider 10 | width: parent.width 11 | anchors.top: parent.top 12 | anchors.left: parent.left 13 | anchors.right: parent.right 14 | z: 2 15 | } 16 | ListView { 17 | z: 1 18 | anchors.top: slider.bottom 19 | anchors.bottom: parent.bottom 20 | anchors.left: parent.left 21 | anchors.right: parent.right 22 | id: pythonList 23 | model: pythonListModel 24 | 25 | delegate: Component { 26 | Rectangle { 27 | width: pythonList.width 28 | height: 20 + slider.value 29 | gradient: Gradient { 30 | GradientStop { position: 0; color: model.zenItem.checked?"#00B8F5":(index%2?"#eee":"#ddd") } 31 | GradientStop { position: .93; color: model.zenItem.checked?"#0080A0":"#eee" } 32 | GradientStop { position: 1; color: "#666" } 33 | } 34 | Text { 35 | elide: Text.ElideRight 36 | text: model.zenItem.name 37 | color: (model.zenItem.checked?"white":"black") 38 | anchors { 39 | verticalCenter: parent.verticalCenter 40 | left: parent.left 41 | right: (model.zenItem.checked?checkbox.left:parent.right) 42 | leftMargin: 5 43 | } 44 | } 45 | Text { 46 | id: checkbox 47 | z: 5 48 | text: "✔" 49 | font.pixelSize: parent.height 50 | font.bold: true 51 | visible: model.zenItem.checked 52 | transformOrigin: Item.Right 53 | color: "white" 54 | anchors { 55 | verticalCenter: parent.verticalCenter 56 | right: parent.right 57 | rightMargin: 5 58 | } 59 | } 60 | MouseArea { 61 | anchors.fill: parent 62 | onClicked: { controller.toggled(pythonListModel, model.zenItem, checkbox, parent) } 63 | } 64 | } 65 | } 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /MyProgressBar.qml: -------------------------------------------------------------------------------- 1 | 2 | import Qt 4.7 3 | 4 | Rectangle { 5 | id: progressBar 6 | color: "#aaa" 7 | height: 20 8 | 9 | property real progress: 0 10 | property int size: 0 11 | 12 | function formatProgress(size, progress) { 13 | return "" + parseInt(progress*size/1024) + 14 | " KiB ("+parseInt(progress*100.) + "%)"; 15 | } 16 | 17 | 18 | Rectangle { 19 | color: progressBar.progress<1?"#ee8":"#8e8" 20 | clip: true 21 | 22 | anchors { 23 | top: parent.top 24 | bottom: parent.bottom 25 | left: parent.left 26 | } 27 | 28 | width: parent.width*progressBar.progress 29 | 30 | Text { 31 | anchors { 32 | fill: parent 33 | rightMargin: 5 34 | } 35 | color: "black" 36 | text: formatProgress(progressBar.size, progressBar.progress) 37 | verticalAlignment: Text.AlignVCenter 38 | horizontalAlignment: Text.AlignRight 39 | } 40 | } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /PythonList.py: -------------------------------------------------------------------------------- 1 | 2 | # -*- coding: utf-8 -*- 3 | 4 | import sys 5 | 6 | from PySide import QtCore 7 | from PySide import QtGui 8 | from PySide import QtDeclarative 9 | from PySide import QtOpenGL 10 | 11 | class ThingWrapper(QtCore.QObject): 12 | def __init__(self, thing): 13 | QtCore.QObject.__init__(self) 14 | self._thing = thing 15 | 16 | def _name(self): 17 | return str(self._thing) 18 | 19 | changed = QtCore.Signal() 20 | 21 | name = QtCore.Property(unicode, _name, notify=changed) 22 | 23 | class ThingListModel(QtCore.QAbstractListModel): 24 | COLUMNS = ['thing'] 25 | 26 | def __init__(self, things): 27 | QtCore.QAbstractListModel.__init__(self) 28 | self._things = things 29 | self.setRoleNames(dict(enumerate(ThingListModel.COLUMNS))) 30 | 31 | def rowCount(self, parent=QtCore.QModelIndex()): 32 | return len(self._things) 33 | 34 | def data(self, index, role): 35 | if index.isValid() and role == ThingListModel.COLUMNS.index('thing'): 36 | return self._things[index.row()] 37 | return None 38 | 39 | class Controller(QtCore.QObject): 40 | @QtCore.Slot(QtCore.QObject) 41 | def thingSelected(self, wrapper): 42 | print 'User clicked on:', wrapper._thing.name 43 | if wrapper._thing.number > 10: 44 | print 'The number is greater than ten!' 45 | 46 | app = QtGui.QApplication(sys.argv) 47 | 48 | m = QtGui.QMainWindow() 49 | 50 | view = QtDeclarative.QDeclarativeView() 51 | glw = QtOpenGL.QGLWidget() 52 | view.setViewport(glw) 53 | view.setResizeMode(QtDeclarative.QDeclarativeView.SizeRootObjectToView) 54 | 55 | class Person(object): 56 | def __init__(self, name, number): 57 | self.name = name 58 | self.number = number 59 | 60 | def __str__(self): 61 | return 'Person "%s" (%d)' % (self.name, self.number) 62 | 63 | people = [ 64 | Person('Locke', 4), 65 | Person('Reyes', 8), 66 | Person('Ford', 15), 67 | Person('Jarrah', 16), 68 | Person('Shephard', 23), 69 | Person('Kwon', 42), 70 | ] 71 | 72 | # Wrap persons into QObjects for property access in QML 73 | things = [ThingWrapper(thing) for thing in people] 74 | 75 | controller = Controller() 76 | thingList = ThingListModel(things) 77 | 78 | rc = view.rootContext() 79 | 80 | rc.setContextProperty('controller', controller) 81 | rc.setContextProperty('pythonListModel', thingList) 82 | 83 | view.setSource('PythonList.qml') 84 | m.setCentralWidget(view) 85 | 86 | m.show() 87 | 88 | app.exec_() 89 | 90 | 91 | -------------------------------------------------------------------------------- /PythonList.qml: -------------------------------------------------------------------------------- 1 | 2 | import Qt 4.7 3 | 4 | ListView { 5 | id: pythonList 6 | width: 400 7 | height: 200 8 | 9 | model: pythonListModel 10 | 11 | delegate: Component { 12 | Rectangle { 13 | width: pythonList.width 14 | height: 40 15 | color: ((index % 2 == 0)?"#222":"#111") 16 | Text { 17 | id: title 18 | elide: Text.ElideRight 19 | text: model.thing.name 20 | color: "white" 21 | font.bold: true 22 | anchors.leftMargin: 10 23 | anchors.fill: parent 24 | verticalAlignment: Text.AlignVCenter 25 | } 26 | MouseArea { 27 | anchors.fill: parent 28 | onClicked: { controller.thingSelected(model.thing) } 29 | } 30 | } 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /Translucent.py: -------------------------------------------------------------------------------- 1 | 2 | from PySide.QtCore import * 3 | from PySide.QtGui import * 4 | from PySide.QtDeclarative import * 5 | 6 | class TranslucentView(QDeclarativeView): 7 | def __init__(self): 8 | QDeclarativeView.__init__(self) 9 | self.setAttribute(Qt.WA_TranslucentBackground) 10 | self.viewport().setAutoFillBackground(False) 11 | 12 | app = QApplication([]) 13 | view = TranslucentView() 14 | view.setWindowTitle('Translucent QML Windows') 15 | view.setSource(__file__.replace('.py', '.qml')) 16 | view.setResizeMode(QDeclarativeView.SizeRootObjectToView) 17 | view.showFullScreen() 18 | app.exec_() 19 | 20 | -------------------------------------------------------------------------------- /Translucent.qml: -------------------------------------------------------------------------------- 1 | 2 | import Qt 4.7 3 | 4 | 5 | Item { 6 | width: 400 7 | height: 400 8 | Rectangle { 9 | color: 'black' 10 | anchors.fill: parent 11 | gradient: Gradient { 12 | GradientStop { position: 0; color: 'transparent' } 13 | GradientStop { position: 1; color: 'black' } 14 | } 15 | //opacity: .4 16 | } 17 | 18 | Image { 19 | id: rect 20 | //width: 200 21 | //height: 200 22 | anchors.centerIn: parent 23 | //opacity: .5 24 | source: 'images/pyside-rounded-corners.png' 25 | //color: 'red' 26 | 27 | RotationAnimation { 28 | target: rect 29 | property: 'rotation' 30 | from: 0 31 | to: 360 32 | loops: Animation.Infinite 33 | running: true 34 | duration: 2500 35 | } 36 | 37 | SequentialAnimation { 38 | running: true 39 | loops: Animation.Infinite 40 | PropertyAnimation { 41 | target: rect 42 | property: 'scale' 43 | from: 1 44 | to: 2 45 | duration: 1000 46 | easing.type: Easing.OutBounce 47 | } 48 | PropertyAnimation { 49 | target: rect 50 | property: 'scale' 51 | from: 2 52 | to: 1 53 | duration: 2500 54 | easing.type: Easing.OutExpo 55 | } 56 | } 57 | } 58 | } 59 | 60 | -------------------------------------------------------------------------------- /UnderMeSensi.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Be sure to install python-qtmobility and run on a N900 :) 3 | 4 | import sys 5 | 6 | from PySide import QtCore, QtGui, QtDeclarative, QtOpenGL 7 | from QtMobility import Sensors 8 | 9 | class Listener(QtCore.QObject): 10 | def __init__(self): 11 | QtCore.QObject.__init__(self) 12 | self._initial = True 13 | self._rotation = 0. 14 | self._tilt = 0. 15 | 16 | def get_rotation(self): 17 | return self._rotation 18 | 19 | def set_rotation(self, rotation): 20 | if self._initial: 21 | self._rotation = rotation 22 | self._initial = False 23 | else: 24 | # Smooth the accelermeter input changes 25 | self._rotation *= .8 26 | self._rotation += .2*rotation 27 | 28 | self.on_rotation.emit() 29 | 30 | def get_tilt(self): 31 | return self._tilt 32 | 33 | def set_tilt(self, tilt): 34 | self._tilt = tilt 35 | self.on_rotation.emit() 36 | 37 | on_rotation = QtCore.Signal() 38 | rotation = QtCore.Property(float, get_rotation, set_rotation, \ 39 | notify=on_rotation) 40 | tilt = QtCore.Property(float, get_tilt, set_tilt, \ 41 | notify=on_rotation) 42 | 43 | @QtCore.Slot() 44 | def on_reading_changed(self): 45 | accel = self.sender() 46 | # Scale the x axis reading to keep the image roughly steady 47 | self.rotation = accel.reading().x()*7 48 | self.tilt = (accel.reading().y()-10)*8 49 | 50 | app = QtGui.QApplication(sys.argv) 51 | 52 | accel = Sensors.QAccelerometer() 53 | listener = Listener() 54 | accel.readingChanged.connect(listener.on_reading_changed) 55 | accel.start() 56 | 57 | view = QtDeclarative.QDeclarativeView() 58 | glw = QtOpenGL.QGLWidget() 59 | view.setViewport(glw) 60 | view.setResizeMode(QtDeclarative.QDeclarativeView.SizeRootObjectToView) 61 | view.rootContext().setContextProperty('listener', listener) 62 | view.setSource(__file__.replace('.py', '.qml')) 63 | view.showFullScreen() 64 | 65 | app.exec_() 66 | 67 | -------------------------------------------------------------------------------- /UnderMeSensi.qml: -------------------------------------------------------------------------------- 1 | import Qt 4.7 2 | 3 | Rectangle { 4 | width: 800 5 | height: 480 6 | 7 | Image { 8 | id: img 9 | source: "images/pysidelogo.png" 10 | fillMode: Image.PreserveAspectFit 11 | width: parent.width/2 12 | height: parent.height/2 13 | anchors.centerIn: parent 14 | transform: [ 15 | Rotation { 16 | origin { 17 | x: img.width/2 18 | y: img.height/2 19 | } 20 | axis { x: 1; y: 0; z: 0 } 21 | angle: listener.tilt 22 | }, 23 | Rotation { 24 | origin { 25 | x: img.width/2 26 | y: img.height/2 27 | } 28 | axis { x: 0; y: 0; z: 1 } 29 | angle: listener.rotation 30 | } 31 | ] 32 | } 33 | 34 | Text { 35 | anchors.left: parent.left 36 | anchors.bottom: parent.bottom 37 | color: "#aaa" 38 | text: "To quit, press Ctrl+Backspace, then close" 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /WebKitView.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 21 | 22 | 23 |25 | Set rotation: 26 | 27 | 28 |
29 |30 | Send arbitrary data structures: 31 | 32 |
33 |Received stuff:
34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /WebKitView.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import sys 4 | import time 5 | 6 | try: 7 | import simplejson as json 8 | except ImportError: 9 | import json 10 | 11 | from PySide import QtCore, QtGui, QtDeclarative 12 | 13 | def sendData(data): 14 | global rootObject 15 | print 'Sending data:', data 16 | json_str = json.dumps(data).replace('"', '\\"') 17 | rootObject.evaluateJavaScript('receiveJSON("%s")' % json_str) 18 | 19 | def receiveData(json_str): 20 | global rootObject 21 | 22 | data = json.loads(json_str) 23 | print 'Received data:', data 24 | 25 | if len(data) == 2 and data[0] == 'setRotation': 26 | animation = QtCore.QPropertyAnimation(rootObject, 'rotation', rootObject) 27 | animation.setDuration(3000) 28 | animation.setEasingCurve(QtCore.QEasingCurve.InOutElastic) 29 | # eh immer: animation.setStartValue(rootObject.property('rotation')) 30 | animation.setEndValue(data[1]) 31 | animation.start(QtCore.QAbstractAnimation.DeleteWhenStopped) 32 | #rootObject.setProperty('rotation', data[1]) 33 | else: 34 | sendData({'Hello': 'from PySide', 'itsNow': int(time.time())}) 35 | 36 | app = QtGui.QApplication(sys.argv) 37 | 38 | view = QtDeclarative.QDeclarativeView() 39 | view.setRenderHints(QtGui.QPainter.SmoothPixmapTransform) 40 | view.setSource(__file__.replace('.py', '.qml')) 41 | rootObject = view.rootObject() 42 | rootObject.setProperty('url', __file__.replace('.py', '.html')) 43 | rootObject.alert.connect(receiveData) 44 | view.show() 45 | 46 | app.exec_() 47 | 48 | -------------------------------------------------------------------------------- /WebKitView.qml: -------------------------------------------------------------------------------- 1 | import QtWebKit 1.0 2 | 3 | WebView { settings.javascriptEnabled: true; width: 400; height: 280 } 4 | 5 | -------------------------------------------------------------------------------- /WorkingOnIt-colibri.qml: -------------------------------------------------------------------------------- 1 | 2 | import Qt 4.7 3 | import "colibri" 4 | 5 | Rectangle { 6 | width: 200; height: 160 7 | 8 | Text { 9 | x: progressBar.x; y: 20 10 | width: progressBar.width 11 | font.pixelSize: 8 12 | text: downloader.filename 13 | elide: Text.ElideRight 14 | } 15 | 16 | 17 | CLProgressBar { 18 | id: progressBar 19 | x: 20; y: 60 20 | width: parent.width-40 21 | 22 | value: downloader.progress*100 23 | } 24 | 25 | 26 | CLButton { 27 | anchors.left: progressBar.left 28 | anchors.right: progressBar.right 29 | 30 | y: progressBar.y + progressBar.height + 20 31 | 32 | text: downloader.running?"Please wait...":"Start download" 33 | onClicked: { downloader.start_download() } 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /WorkingOnIt.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import os 4 | import sys 5 | import threading 6 | import urllib 7 | 8 | from PySide import QtCore, QtGui, QtDeclarative 9 | 10 | class Downloader(QtCore.QObject): 11 | def __init__(self, url, filename=None): 12 | QtCore.QObject.__init__(self) 13 | self._url = url 14 | if filename is None: 15 | filename = os.path.basename(self._url) 16 | self._filename = filename 17 | self._progress = 0. 18 | self._running = False 19 | self._size = -1 20 | 21 | def _download(self): 22 | def reporthook(pos, block, total): 23 | if self.size != total: 24 | self._size = total 25 | self.on_size.emit() 26 | self.progress = float(pos*block)/float(total) 27 | urllib.urlretrieve(self._url, self._filename, reporthook) 28 | self.running = False 29 | 30 | @QtCore.Slot() 31 | def start_download(self): 32 | if not self.running: 33 | self.running = True 34 | thread = threading.Thread(target=self._download) 35 | thread.start() 36 | 37 | def _get_progress(self): 38 | return self._progress 39 | 40 | def _set_progress(self, progress): 41 | self._progress = progress 42 | self.on_progress.emit() 43 | 44 | def _get_running(self): 45 | return self._running 46 | 47 | def _set_running(self, running): 48 | self._running = running 49 | self.on_running.emit() 50 | 51 | def _get_filename(self): 52 | return self._filename 53 | 54 | def _get_size(self): 55 | return self._size 56 | 57 | on_progress = QtCore.Signal() 58 | on_running = QtCore.Signal() 59 | on_filename = QtCore.Signal() 60 | on_size = QtCore.Signal() 61 | 62 | progress = QtCore.Property(float, _get_progress, _set_progress, 63 | notify=on_progress) 64 | running = QtCore.Property(bool, _get_running, _set_running, 65 | notify=on_running) 66 | filename = QtCore.Property(str, _get_filename, notify=on_filename) 67 | size = QtCore.Property(int, _get_size, notify=on_size) 68 | 69 | 70 | downloader = Downloader('http://repo.meego.com/MeeGo/builds/trunk/1.1.80.8.20101130.1/handset/images/meego-handset-armv7l-n900/meego-handset-armv7l-n900-1.1.80.8.20101130.1-vmlinuz-2.6.35.3-13.6-n900') 71 | 72 | app = QtGui.QApplication(sys.argv) 73 | view = QtDeclarative.QDeclarativeView() 74 | view.rootContext().setContextProperty('downloader', downloader) 75 | if sys.argv[-1].endswith('.qml'): 76 | view.setSource(sys.argv[-1]) 77 | else: 78 | view.setSource(__file__.replace('.py', '.qml')) 79 | view.show() 80 | app.exec_() 81 | 82 | -------------------------------------------------------------------------------- /WorkingOnIt.qml: -------------------------------------------------------------------------------- 1 | 2 | import Qt 4.7 3 | 4 | Rectangle { 5 | width: 200; height: 160 6 | 7 | Text { 8 | x: progressBar.x; y: 20 9 | width: progressBar.width 10 | font.pixelSize: 8 11 | text: downloader.filename 12 | elide: Text.ElideRight 13 | } 14 | 15 | MyProgressBar { 16 | id: progressBar 17 | x: 20; y: 60 18 | width: parent.width-40 19 | progress: downloader.progress 20 | size: downloader.size 21 | } 22 | 23 | Rectangle { 24 | anchors.left: progressBar.left 25 | anchors.right: progressBar.right 26 | 27 | color: "#aad" 28 | y: progressBar.y + progressBar.height + 20 29 | height: 40 30 | 31 | Text { 32 | anchors.fill: parent 33 | color: "#003" 34 | text: downloader.running?"Please wait...":"Start download" 35 | 36 | verticalAlignment: Text.AlignVCenter 37 | horizontalAlignment: Text.AlignHCenter 38 | } 39 | 40 | MouseArea { 41 | anchors.fill: parent 42 | onClicked: { downloader.start_download() } 43 | } 44 | } 45 | } 46 | 47 | -------------------------------------------------------------------------------- /call_javascript_from_python.py: -------------------------------------------------------------------------------- 1 | 2 | import sys 3 | 4 | from PySide.QtCore import * 5 | from PySide.QtGui import * 6 | from PySide.QtDeclarative import * 7 | 8 | class Forwarder(QObject): 9 | def __init__(self): 10 | QObject.__init__(self) 11 | 12 | # This signal can be emitted from Python and connected to from QML 13 | doSomething = Signal() 14 | 15 | app = QApplication(sys.argv) 16 | view = QDeclarativeView() 17 | forwarder = Forwarder() 18 | 19 | context = view.rootContext() 20 | context.setContextProperty('forwarder', forwarder) 21 | 22 | view.setSource(__file__.replace('.py', '.qml')) 23 | view.show() 24 | 25 | def timer_on_timeout(): 26 | print 'Doing something from Python...' 27 | # Emit the signal (will be received by QML) 28 | forwarder.doSomething.emit() 29 | 30 | timer = QTimer() 31 | timer.timeout.connect(timer_on_timeout) 32 | timer.start(1000) 33 | 34 | sys.exit(app.exec_()) 35 | 36 | -------------------------------------------------------------------------------- /call_javascript_from_python.qml: -------------------------------------------------------------------------------- 1 | 2 | import QtQuick 1.0 3 | 4 | Rectangle { 5 | width: 200 6 | height: 200 7 | 8 | Connections { 9 | target: forwarder 10 | onDoSomething: { 11 | // This is called whenever the "forwarder" in Python 12 | // emits the "doSomething" signal -> do something here 13 | console.log('...and do something else in QML.') 14 | text.rotation += 45 15 | } 16 | } 17 | 18 | Text { 19 | id: text 20 | anchors.centerIn: parent 21 | text: 'Call Javascript\nFrom Python' 22 | Behavior on rotation { RotationAnimation { } } 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /colibri/CLButton.qml: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright © 2010 Digia Plc 3 | * Copyright © 2010 Nokia Corporation 4 | * 5 | * All rights reserved. 6 | * 7 | * Nokia and Nokia Connecting People are registered trademarks of 8 | * Nokia Corporation. 9 | * Java and all Java-based marks are trademarks or registered 10 | * trademarks of 11 | * Sun Microsystems, Inc. Other product and company names 12 | * mentioned herein may be 13 | * trademarks or trade names of their respective owners. 14 | * 15 | * 16 | * Subject to the conditions below, you may, without charge: 17 | * 18 | * · Use, copy, modify and/or merge copies of this software and 19 | * associated documentation files (the "Software") 20 | * 21 | * · Publish, distribute, sub-licence and/or sell new software 22 | * derived from or incorporating the Software. 23 | * 24 | * 25 | * This file, unmodified, shall be included with all copies or 26 | * substantial portions 27 | * of the Software that are distributed in source code form. 28 | * 29 | * The Software cannot constitute the primary value of any new 30 | * software derived 31 | * from or incorporating the Software. 32 | * 33 | * Any person dealing with the Software shall not misrepresent 34 | * the source of the Software. 35 | * 36 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 37 | * KIND, EXPRESS OR IMPLIED, 38 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 39 | * MERCHANTABILITY, FITNESS FOR A 40 | * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 41 | * AUTHORS OR COPYRIGHT 42 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 43 | * WHETHER IN AN ACTION 44 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 45 | * CONNECTION WITH THE 46 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 47 | */ 48 | import Qt 4.7 49 | import "javascripts/functions.js" as Functions 50 | 51 | Rectangle { 52 | id: rectangle 53 | 54 | property CLStyle style: CLStyle {} 55 | property alias text: text.text 56 | property color colorWhenDefault: style.colorWhenDefault 57 | property color colorWhenPressed: style.colorWhenPressed 58 | property color colorWhenHovered: style.colorWhenHovered 59 | property color colorWhenSelected: style.colorWhenSelected 60 | property color textColor: style.textColor 61 | property real roundness: style.roundness 62 | property color borderColor: style.borderColor 63 | property int borderWidth: style.borderWidth 64 | property real fontSize: style.fontSize 65 | property string fontFamily: style.fontFamily 66 | property string fontWeight: style.fontWeight 67 | property color borderColorWhenHovered: style.borderColorWhenHovered 68 | property color borderColorWhenPressed: style.borderColorWhenPressed 69 | property color borderColorWhenSelected: style.borderColorWhenSelected 70 | 71 | /* Properties for background images 72 | * -------------------------------- 73 | * This solution is temporary. Remember performance. 74 | */ 75 | //Private properties start 76 | property Image nullImage: Image { //this property is "private" don't write it to documentation 77 | id: "null" 78 | source: "" 79 | width: rectangle.height 80 | height: rectangle.height 81 | fillMode: Image.PreserveAspectCrop 82 | smooth: false 83 | scale: 1 84 | } 85 | property Gradient nullGradient: Gradient{} 86 | property Image currentImage: backgroundImageWhenDefault //this property is "private" don't write it to documentation 87 | //Private properties end 88 | 89 | property Image backgroundImage: nullImage 90 | property Image backgroundImageWhenDefault: backgroundImage 91 | property Image backgroundImageWhenHovered: backgroundImage 92 | property Image backgroundImageWhenPressed: backgroundImage 93 | property Image backgroundImageWhenSelected: backgroundImage 94 | 95 | property bool gradientDefaultOn: style.gradientDefaultOn 96 | property bool gradientHoveredOn: style.gradientHoveredOn 97 | property bool gradientPressedOn: style.gradientPressedOn 98 | property bool gradientSelectedOn: style.gradientSelectedOn 99 | 100 | property bool hoveredStateOn: style.hoveredStateOn 101 | property bool pressedStateOn: style.pressedStateOn 102 | 103 | property Gradient gradientWhenDefault: style.gradientWhenDefault 104 | property Gradient gradientWhenHovered: style.gradientWhenHovered 105 | property Gradient gradientWhenPressed: style.gradientWhenPressed 106 | property Gradient gradientWhenSelected: style.gradientWhenSelected 107 | 108 | property bool disabled: false 109 | property bool selected: false 110 | 111 | property string textAlign: "center" 112 | property string imageAlign: "center" 113 | property real leftMargin: 0 114 | property real rightMargin: 0 115 | 116 | signal clicked() 117 | 118 | Component.onCompleted: { 119 | if(!hoveredStateOn) stateHovered.destroy(); 120 | if(!pressedStateOn) statePressed.destroy(); 121 | } 122 | 123 | width: text.width + 15 124 | height: text.height + 15 125 | color: colorWhenDefault 126 | smooth: true 127 | radius: Functions.countRadius(roundness,width,height,0,1) 128 | border.color: borderColor 129 | border.width: borderWidth 130 | gradient: (gradientDefaultOn)?gradientWhenDefault:nullGradient 131 | 132 | Image { 133 | id: image 134 | 135 | source: currentImage.source 136 | width: currentImage.width 137 | height: currentImage.height 138 | fillMode: currentImage.fillMode 139 | smooth: currentImage.smooth 140 | scale: currentImage.scale 141 | anchors.left: if(imageAlign == "left") parent.left 142 | anchors.right: if(imageAlign == "right") parent.right 143 | anchors.horizontalCenter: if(imageAlign == "center") parent.horizontalCenter 144 | anchors.verticalCenter: parent.verticalCenter 145 | x: currentImage.x 146 | y: currentImage.y 147 | //TODO: add all image properties and get them from current image 148 | } 149 | 150 | Text { 151 | id: text 152 | 153 | text: "CLButton" 154 | anchors.horizontalCenter: if(textAlign == "center") rectangle.horizontalCenter 155 | anchors.left: if(textAlign == "left") rectangle.left 156 | anchors.right: if(textAlign == "right" ) rectangle.right 157 | anchors.rightMargin: rightMargin 158 | anchors.leftMargin: leftMargin 159 | anchors.verticalCenter: rectangle.verticalCenter 160 | font.family: fontFamily 161 | font.pointSize: 0.001 + fontSize 162 | color: textColor 163 | font.weight: fontWeight 164 | } 165 | 166 | MouseArea { 167 | id: mouseArea 168 | 169 | anchors.fill: parent 170 | onClicked: rectangle.clicked() 171 | hoverEnabled: true 172 | } 173 | 174 | state: "" 175 | 176 | states: [ 177 | State { 178 | id: statePressed 179 | name: "pressed"; when: mouseArea.pressed && !disabled 180 | PropertyChanges { target: rectangle; gradient: (gradientPressedOn)?gradientWhenPressed:nullGradient; color: colorWhenPressed; } 181 | PropertyChanges { target: rectangle; border.color: borderColorWhenPressed } 182 | PropertyChanges { target: rectangle; color: colorWhenPressed} 183 | PropertyChanges { target: rectangle; currentImage: backgroundImageWhenPressed} 184 | }, 185 | State { 186 | id: stateSelected 187 | name: "selected"; when: selected 188 | PropertyChanges { target: rectangle; gradient: (gradientSelectedOn)?gradientWhenSelected:nullGradient; color: colorWhenSelected; } 189 | PropertyChanges { target: rectangle; border.color: borderColorWhenSelected } 190 | PropertyChanges { target: rectangle; color: colorWhenSelected} 191 | PropertyChanges { target: rectangle; currentImage: backgroundImageWhenSelected } 192 | }, 193 | State { 194 | id: stateHovered 195 | name: "entered"; when: mouseArea.containsMouse && !disabled 196 | PropertyChanges { target: rectangle; gradient: (gradientHoveredOn)?gradientWhenHovered:nullGradient; color: colorWhenHovered; } 197 | PropertyChanges { target: rectangle; border.color: borderColorWhenHovered } 198 | PropertyChanges { target: rectangle; color: colorWhenHovered} 199 | PropertyChanges { target: rectangle; currentImage: backgroundImageWhenHovered } 200 | }, 201 | State { 202 | id: stateDisabled 203 | name: "disabled"; when: disabled 204 | PropertyChanges {target: rectangle; color: if(gradientDefaultOn) "white"; else colorWhenDefault} 205 | PropertyChanges {target: rectangle; opacity: 0.6} 206 | PropertyChanges {target: mouseArea; enabled: false} 207 | } 208 | ] 209 | } 210 | -------------------------------------------------------------------------------- /colibri/CLCarousel.qml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/CLCarousel.qml -------------------------------------------------------------------------------- /colibri/CLCheckBox.qml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/CLCheckBox.qml -------------------------------------------------------------------------------- /colibri/CLComboBox.qml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/CLComboBox.qml -------------------------------------------------------------------------------- /colibri/CLDatePicker.qml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/CLDatePicker.qml -------------------------------------------------------------------------------- /colibri/CLDial.qml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/CLDial.qml -------------------------------------------------------------------------------- /colibri/CLHistogram.qml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/CLHistogram.qml -------------------------------------------------------------------------------- /colibri/CLKeyboard.qml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/CLKeyboard.qml -------------------------------------------------------------------------------- /colibri/CLLayer.qml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/CLLayer.qml -------------------------------------------------------------------------------- /colibri/CLLineEdit.qml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/CLLineEdit.qml -------------------------------------------------------------------------------- /colibri/CLListbox.qml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/CLListbox.qml -------------------------------------------------------------------------------- /colibri/CLProgressBar.qml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/CLProgressBar.qml -------------------------------------------------------------------------------- /colibri/CLRating.qml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/CLRating.qml -------------------------------------------------------------------------------- /colibri/CLScrollBar.qml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/CLScrollBar.qml -------------------------------------------------------------------------------- /colibri/CLScrollBarVertical.qml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/CLScrollBarVertical.qml -------------------------------------------------------------------------------- /colibri/CLSlider.qml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/CLSlider.qml -------------------------------------------------------------------------------- /colibri/CLSliderVertical.qml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/CLSliderVertical.qml -------------------------------------------------------------------------------- /colibri/CLStyle.qml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/CLStyle.qml -------------------------------------------------------------------------------- /colibri/CLTab.qml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/CLTab.qml -------------------------------------------------------------------------------- /colibri/CLTextArea.qml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/CLTextArea.qml -------------------------------------------------------------------------------- /colibri/gradients/Blue.qml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/gradients/Blue.qml -------------------------------------------------------------------------------- /colibri/gradients/Grey.qml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/gradients/Grey.qml -------------------------------------------------------------------------------- /colibri/gradients/LightBlue.qml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/gradients/LightBlue.qml -------------------------------------------------------------------------------- /colibri/gradients/Red.qml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/gradients/Red.qml -------------------------------------------------------------------------------- /colibri/images/arrow_down_50x50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/images/arrow_down_50x50.png -------------------------------------------------------------------------------- /colibri/images/arrow_left_50x50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/images/arrow_left_50x50.png -------------------------------------------------------------------------------- /colibri/images/arrow_right_50x50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/images/arrow_right_50x50.png -------------------------------------------------------------------------------- /colibri/images/arrow_up_50x50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/images/arrow_up_50x50.png -------------------------------------------------------------------------------- /colibri/images/backspace_50x70.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/images/backspace_50x70.png -------------------------------------------------------------------------------- /colibri/images/calendar_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/images/calendar_icon.png -------------------------------------------------------------------------------- /colibri/images/cover1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/images/cover1.jpg -------------------------------------------------------------------------------- /colibri/images/cover2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/images/cover2.jpg -------------------------------------------------------------------------------- /colibri/images/cover3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/images/cover3.jpg -------------------------------------------------------------------------------- /colibri/images/cover4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/images/cover4.jpg -------------------------------------------------------------------------------- /colibri/images/cover5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/images/cover5.jpg -------------------------------------------------------------------------------- /colibri/images/cover6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/images/cover6.jpg -------------------------------------------------------------------------------- /colibri/images/cover7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/images/cover7.jpg -------------------------------------------------------------------------------- /colibri/images/cover8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/images/cover8.jpg -------------------------------------------------------------------------------- /colibri/images/delete_50x50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/images/delete_50x50.png -------------------------------------------------------------------------------- /colibri/images/enter_50x70.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/images/enter_50x70.png -------------------------------------------------------------------------------- /colibri/images/lock_closed_web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/images/lock_closed_web.png -------------------------------------------------------------------------------- /colibri/images/lock_open_web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/images/lock_open_web.png -------------------------------------------------------------------------------- /colibri/images/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/images/logo.jpg -------------------------------------------------------------------------------- /colibri/images/logo_transparent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/images/logo_transparent.png -------------------------------------------------------------------------------- /colibri/images/logo_transparent2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/images/logo_transparent2.png -------------------------------------------------------------------------------- /colibri/images/ok_50x50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/images/ok_50x50.png -------------------------------------------------------------------------------- /colibri/images/shift_50x50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/images/shift_50x50.png -------------------------------------------------------------------------------- /colibri/images/star_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/images/star_off.png -------------------------------------------------------------------------------- /colibri/images/star_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/images/star_on.png -------------------------------------------------------------------------------- /colibri/images/tab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/images/tab.png -------------------------------------------------------------------------------- /colibri/images/tick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/images/tick.png -------------------------------------------------------------------------------- /colibri/includes/Fruits.qml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/includes/Fruits.qml -------------------------------------------------------------------------------- /colibri/includes/HistogramColumn.qml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/includes/HistogramColumn.qml -------------------------------------------------------------------------------- /colibri/includes/KeyboardButton.qml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/includes/KeyboardButton.qml -------------------------------------------------------------------------------- /colibri/includes/RatingStar.qml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/includes/RatingStar.qml -------------------------------------------------------------------------------- /colibri/includes/Screen.qml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/includes/Screen.qml -------------------------------------------------------------------------------- /colibri/includes/TestCoverList.qml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/includes/TestCoverList.qml -------------------------------------------------------------------------------- /colibri/includes/TestItemList.qml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amon-ra/pyside-qml-examples/6e75fb651b44b230159e548914f771f887cc5f55/colibri/includes/TestItemList.qml -------------------------------------------------------------------------------- /colibri/javascripts/date.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Version: 1.0 Alpha-1 3 | * Build Date: 13-Nov-2007 4 | * Copyright (c) 2006-2007, Coolite Inc. (http://www.coolite.com/). All rights reserved. 5 | * License: Licensed under The MIT License. See license.txt and http://www.datejs.com/license/. 6 | * Website: http://www.datejs.com/ or http://www.coolite.com/datejs/ 7 | */ 8 | Date.CultureInfo={name:"en-US",englishName:"English (United States)",nativeName:"English (United States)",dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],shortestDayNames:["Su","Mo","Tu","We","Th","Fr","Sa"],firstLetterDayNames:["S","M","T","W","T","F","S"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],abbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],amDesignator:"AM",pmDesignator:"PM",firstDayOfWeek:0,twoDigitYearMax:2029,dateElementOrder:"mdy",formatPatterns:{shortDate:"M/d/yyyy",longDate:"dddd, MMMM dd, yyyy",shortTime:"h:mm tt",longTime:"h:mm:ss tt",fullDateTime:"dddd, MMMM dd, yyyy h:mm:ss tt",sortableDateTime:"yyyy-MM-ddTHH:mm:ss",universalSortableDateTime:"yyyy-MM-dd HH:mm:ssZ",rfc1123:"ddd, dd MMM yyyy HH:mm:ss GMT",monthDay:"MMMM dd",yearMonth:"MMMM, yyyy"},regexPatterns:{jan:/^jan(uary)?/i,feb:/^feb(ruary)?/i,mar:/^mar(ch)?/i,apr:/^apr(il)?/i,may:/^may/i,jun:/^jun(e)?/i,jul:/^jul(y)?/i,aug:/^aug(ust)?/i,sep:/^sep(t(ember)?)?/i,oct:/^oct(ober)?/i,nov:/^nov(ember)?/i,dec:/^dec(ember)?/i,sun:/^su(n(day)?)?/i,mon:/^mo(n(day)?)?/i,tue:/^tu(e(s(day)?)?)?/i,wed:/^we(d(nesday)?)?/i,thu:/^th(u(r(s(day)?)?)?)?/i,fri:/^fr(i(day)?)?/i,sat:/^sa(t(urday)?)?/i,future:/^next/i,past:/^last|past|prev(ious)?/i,add:/^(\+|after|from)/i,subtract:/^(\-|before|ago)/i,yesterday:/^yesterday/i,today:/^t(oday)?/i,tomorrow:/^tomorrow/i,now:/^n(ow)?/i,millisecond:/^ms|milli(second)?s?/i,second:/^sec(ond)?s?/i,minute:/^min(ute)?s?/i,hour:/^h(ou)?rs?/i,week:/^w(ee)?k/i,month:/^m(o(nth)?s?)?/i,day:/^d(ays?)?/i,year:/^y((ea)?rs?)?/i,shortMeridian:/^(a|p)/i,longMeridian:/^(a\.?m?\.?|p\.?m?\.?)/i,timezone:/^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\s*(\+|\-)\s*\d\d\d\d?)|gmt)/i,ordinalSuffix:/^\s*(st|nd|rd|th)/i,timeContext:/^\s*(\:|a|p)/i},abbreviatedTimeZoneStandard:{GMT:"-000",EST:"-0400",CST:"-0500",MST:"-0600",PST:"-0700"},abbreviatedTimeZoneDST:{GMT:"-000",EDT:"-0500",CDT:"-0600",MDT:"-0700",PDT:"-0800"}}; 9 | Date.getMonthNumberFromName=function(name){var n=Date.CultureInfo.monthNames,m=Date.CultureInfo.abbreviatedMonthNames,s=name.toLowerCase();for(var i=0;i