Example #1
0
 def start(self):
     global client
     if (len(self.email) > 0 and len(self.password) > 0):
         self.email = str(self.email[0])
         self.password = str(base64.b64decode(self.password[0]))
         client = Client(self.email, self.password)
         response = client.login()
     
         if (response['result'] == 'ok'):
             startup = client.notify_startup()
             if (not startup):
                 print_message("Could not startup!")
             else:
                 print_message("Notified!")
     
     else:
         Mbox("Budibox", "Credentials undefined or incorrect. Please login again.") 
         
         # Create the QML user interface.
         view = QDeclarativeView()
         view.setSource(QUrl('qml/main.qml'))
         view.setWindowTitle("Budibox")
         view.setWindowIcon(QIcon("qml/budibox.jpg"))
         
         context = view.rootContext()
         context.setContextProperty("send_data",Receive_data())
         
         # Display the user interface and allow the user to interact with it.
         view.setGeometry(360, 360, 360, 360)
         view.setMaximumSize(360, 360)
         view.show()
         
         app.exec_()
Example #2
0
from softwarecenter.db.pkginfo import get_pkg_info

from pkglist import PkgListModel
from reviewslist import ReviewsListModel
from categoriesmodel import CategoriesModel

if __name__ == '__main__':
    app = QApplication(sys.argv)

    # TODO do this async
    app.cache = get_pkg_info()
    app.cache.open()

    view = QDeclarativeView()
    view.setWindowTitle(view.tr("Ubuntu Software Center"))
    view.setWindowIcon(QIcon(os.path.join(os.path.dirname(__file__), "../../../data/icons/scalable/apps/softwarecenter.svg")))
    view.setResizeMode(QtDeclarative.QDeclarativeView.SizeRootObjectToView)

    # ideally this should be part of the qml by using a qmlRegisterType()
    # but that does not seem to be supported in pyside yet(?) so we need
    # to cowboy it in here
    pkglistmodel = PkgListModel()
    reviewslistmodel = ReviewsListModel()
    categoriesmodel = CategoriesModel()
    rc = view.rootContext()
    rc.setContextProperty('pkglistmodel', pkglistmodel)
    rc.setContextProperty('reviewslistmodel', reviewslistmodel)
    rc.setContextProperty('categoriesmodel', categoriesmodel)

    # debug
Example #3
0
    if options.debug:
        log.root.setLevel(level=logging.DEBUG)
    else:
        log.root.setLevel(level=logging.INFO)

    dirpath = os.path.dirname(__file__)
    icopath = os.path.join(dirpath, "../data/ico/128/vindoga-flower.png")
    qmlpath = os.path.join(dirpath, "../data/qml/vindoga.qml")

    qapp = QApplication(sys.argv)
    view = QDeclarativeView()

    launchermodel = model.LauncherModel()
    pkglistmodel = model.PackagesModel()
    reviewslistmodel = model.ReviewsModel()
    categoriesmodel = model.CategoriesModel()
    rc = view.rootContext()
    rc.setContextProperty('launchermodel', launchermodel)
    rc.setContextProperty('pkglistmodel', pkglistmodel)
    rc.setContextProperty('reviewslistmodel', reviewslistmodel)
    rc.setContextProperty('categoriesmodel', categoriesmodel)

    view.setSource(QUrl.fromLocalFile(qmlpath))
    view.setResizeMode(QtDeclarative.QDeclarativeView.SizeRootObjectToView)
    view.setWindowTitle(view.tr("Algorete Market"))
    view.setWindowIcon(QIcon(icopath))

    view.show()
    sys.exit(qapp.exec_())