예제 #1
0
    def __init__(self, parent=None):
        super(StartPage, self).__init__(parent)
        vbox = QVBoxLayout(self)
        vbox.setContentsMargins(0, 0, 0, 0)
        vbox.setSpacing(0)
        self.view = QDeclarativeView()
        self.view.setMinimumWidth(400)
        self.view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
        self.view.setSource(ui_tools.get_qml_resource("StartPage.qml"))
        self.root = self.view.rootObject()
        vbox.addWidget(self.view)

        self.load_items()

        self.connect(self.root, SIGNAL("openProject(QString)"),
            self._open_project)
        self.connect(self.root, SIGNAL("removeProject(QString)"),
            self._on_click_on_delete)
        self.connect(self.root, SIGNAL("markAsFavorite(QString, bool)"),
            self._on_click_on_favorite)
        self.connect(self.root, SIGNAL("openPreferences()"),
            lambda: self.emit(SIGNAL("openPreferences()")))
        self.connect(self.root, SIGNAL("newFile()"),
            lambda: self.emit(SIGNAL("newFile()")))

        self.root.set_year(str(datetime.datetime.now().year))
예제 #2
0
    def __init__(self, parent=None):
        super(StartPage, self).__init__(parent)
        self._id = "Start Page"
        vbox = QVBoxLayout(self)
        self.view = QDeclarativeView()
        self.view.setMinimumWidth(430)
        #self.view.setMinimumWidth(400)
        #self.view.setMinimumHeight(500)
        self.view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
        path_qml = QDir.fromNativeSeparators(
            os.path.join(resources.QML_FILES, "StartPage_Alexa.qml"))
            #os.path.join(resources.QML_FILES, "StartPage.qml"))
        path_qml = urlunparse(urlparse(path_qml)._replace(scheme='file'))
        self.view.setSource(QUrl(path_qml))
        self.root = self.view.rootObject()
        vbox.addWidget(self.view)

        self.load_items()

        self.connect(self.root, SIGNAL("openProject(QString)"),
            self._open_project)
        self.connect(self.root, SIGNAL("removeProject(QString)"),
            self._on_click_on_delete)
        self.connect(self.root, SIGNAL("markAsFavorite(QString, bool)"),
            self._on_click_on_favorite)
        self.connect(self.root, SIGNAL("openPreferences()"),
            lambda: self.emit(SIGNAL("openPreferences()")))
예제 #3
0
    def __init__(self, parent=None):
        super(FilesHandler, self).__init__(None,
                                           Qt.FramelessWindowHint | Qt.Popup)
        self._main_container = parent
        self.setAttribute(Qt.WA_TranslucentBackground)
        self.setStyleSheet("background:transparent;")
        # Create the QML user interface.
        self.view = QDeclarativeView()
        self.view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
        self.view.setSource(ui_tools.get_qml_resource("FilesHandler.qml"))
        self._root = self.view.rootObject()
        vbox = QVBoxLayout(self)
        vbox.setContentsMargins(0, 0, 0, 0)
        vbox.setSpacing(0)
        vbox.addWidget(self.view)

        self._model = {}
        self._temp_files = {}
        self._max_index = 0

        self.connect(self._root, SIGNAL("open(QString, QString, QString)"),
                     self._open)
        self.connect(self._root, SIGNAL("close(QString, QString)"),
                     self._close)
        self.connect(self._root, SIGNAL("hide()"), self.hide)
        self.connect(self._root, SIGNAL("fuzzySearch(QString)"),
                     self._fuzzy_search)
예제 #4
0
    def __init__(self, c):

        self.c = c
        self.gnxcache = {}

        self.mw = ModelWrapper(["h", "b", "gnx", "level", "style"])

        #self.add_all_nodes()
        #self.add_subtree(p)
        c._view = view = QDeclarativeView()
        ctx = view.rootContext()

        @g.command("nb-all")
        def nb_all_f(event):
            self.add_all_nodes()

        @g.command("nb-subtree")
        def nb_subtree_f(event):
            p = self.c.p
            self.add_subtree(p)

        ctx.setContextProperty("nodesModel", self.mw.model)

        path = g.os_path_join(g.computeLeoDir(), 'plugins', 'qmlnb', 'qml',
                              'leonbmain.qml')
        view.setSource(QUrl(path))
        view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
        # Display the user interface and allow the user to interact with it.
        view.setGeometry(100, 100, 800, 600)
        view.show()

        c.dummy = view
예제 #5
0
    def __init__(self, parent=None):
        super(LocatorWidget, self).__init__(parent,
                                            Qt.Dialog | Qt.FramelessWindowHint)
        self._parent = parent
        self.setModal(True)
        self.setAttribute(Qt.WA_TranslucentBackground)
        self.setStyleSheet("background:transparent;")
        self.setFixedHeight(400)
        self.setFixedWidth(500)
        # Create the QML user interface.
        view = QDeclarativeView()
        view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
        view.setSource(ui_tools.get_qml_resource("Locator.qml"))
        self._root = view.rootObject()
        vbox = QVBoxLayout(self)
        vbox.setContentsMargins(0, 0, 0, 0)
        vbox.setSpacing(0)
        vbox.addWidget(view)

        self.locate_symbols = locator.LocateSymbolsThread()
        self.connect(self.locate_symbols, SIGNAL("finished()"), self._cleanup)
        self.connect(self.locate_symbols, SIGNAL("terminated()"),
                     self._cleanup)

        # Locator things
        self.filterPrefix = re.compile(r'(@|<|>|-|!|\.|/|:)')
        self.page_items_step = 10
        self._colors = {
            "@": "white",
            "<": "#18ff6a",
            ">": "red",
            "-": "#18e1ff",
            ".": "#f118ff",
            "/": "#fff118",
            ":": "#18ffd6",
            "!": "#ffa018"
        }
        self._filters_list = [("@", "Filename"), ("<", "Class"),
                              (">", "Function"), ("-", "Attribute"),
                              (".", "Current"), ("/", "Opened"), (":", "Line"),
                              ("!", "NoPython")]
        self._replace_symbol_type = {"<": "&lt;", ">": "&gt;"}
        self.reset_values()

        self._filter_actions = {
            '.': self._filter_this_file,
            '/': self._filter_tabs,
            ':': self._filter_lines
        }

        self.connect(self._root, SIGNAL("textChanged(QString)"),
                     self.set_prefix)
        self.connect(self._root, SIGNAL("open(QString, int)"), self._open_item)
        self.connect(self._root, SIGNAL("fetchMore()"), self._fetch_more)
예제 #6
0
def create_dv():
    # Create the QML user interface.
    view = QDeclarativeView()
    view.setSource(QUrl('qml/leonbmain.qml'))
    view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
    # Display the user interface and allow the user to interact with it.
    view.setGeometry(100, 100, 400, 240)
    view.show()

    rootObject = view.rootObject()
    return view
예제 #7
0
 def __init__(self, parent=None):
     super(SplitOrientation,
           self).__init__(parent, Qt.Dialog | Qt.FramelessWindowHint)
     self.setModal(True)
     self.setAttribute(Qt.WA_TranslucentBackground)
     self.setStyleSheet("background:transparent;")
     self.setFixedHeight(180)
     self.setFixedWidth(315)
     # Create the QML user interface.
     view = QDeclarativeView()
     view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
     view.setSource(ui_tools.get_qml_resource("SplitOrientation.qml"))
     self._root = view.rootObject()
     vbox = QVBoxLayout(self)
     vbox.addWidget(view)
예제 #8
0
    def __init__(self, parent=None):
        super(MainSelector, self).__init__(parent)
        # Create the QML user interface.
        view = QDeclarativeView()
        view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
        view.setSource(ui_tools.get_qml_resource("MainSelector.qml"))
        self._root = view.rootObject()
        vbox = QVBoxLayout(self)
        vbox.setContentsMargins(0, 0, 0, 0)
        vbox.setSpacing(0)
        vbox.addWidget(view)

        self.connect(self._root, SIGNAL("open(int)"),
                     lambda i: self.emit(SIGNAL("changeCurrent(int)"), i))
        self.connect(self._root, SIGNAL("ready()"),
                     lambda: self.emit(SIGNAL("ready()")))
예제 #9
0
    def __init__(self, parent=None):
        super(PluginsStore, self).__init__(parent, Qt.Dialog)
        self.setWindowTitle(translations.TR_MANAGE_PLUGINS)
        vbox = QVBoxLayout(self)
        vbox.setContentsMargins(0, 0, 0, 0)
        vbox.setSpacing(0)
        self.view = QDeclarativeView()
        self.view.setMinimumWidth(800)
        self.view.setMinimumHeight(600)
        self.view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
        self.view.setSource(ui_tools.get_qml_resource("PluginsStore.qml"))
        self.root = self.view.rootObject()
        vbox.addWidget(self.view)
        self._plugins = {}
        self._plugins_inflate = []
        self._plugins_by_tag = collections.defaultdict(list)
        self._plugins_by_author = collections.defaultdict(list)
        self._base_color = QColor("white")
        self._counter = 0
        self._counter_callback = None
        self._inflating_plugins = []
        self._categoryTags = True
        self._search = []
        self.status = None

        self.connect(self.root, SIGNAL("loadPluginsGrid()"),
                     self._load_by_name)
        self.connect(self.root, SIGNAL("showPluginDetails(int)"),
                     self.show_plugin_details)
        self.connect(self.root, SIGNAL("loadTagsGrid()"),
                     self._load_tags_grid)
        self.connect(self.root, SIGNAL("loadAuthorGrid()"),
                     self._load_author_grid)
        self.connect(self.root, SIGNAL("search(QString)"),
                     self._load_search_results)
        self.connect(self.root, SIGNAL("loadPluginsForCategory(QString)"),
                     self._load_plugins_for_category)
        self.connect(self, SIGNAL("processCompleted(PyQt_PyObject)"),
                     self._process_complete)

        self.nenv = nenvironment.NenvEggSearcher()
        self.connect(self.nenv,
                     SIGNAL("searchCompleted(PyQt_PyObject)"),
                     self.callback)
        self.status = self.nenv.do_search()
예제 #10
0
    def __init__(self, parent=None):
        super(Notification, self).__init__(None, Qt.ToolTip)
        self._parent = parent
        self._duration = 3000
        self.setAttribute(Qt.WA_TranslucentBackground)
        self.setAttribute(Qt.WA_TransparentForMouseEvents)
        self.setAttribute(Qt.WA_ShowWithoutActivating)
        self.setStyleSheet("background:transparent;")
        self.setWindowFlags(Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint)
        self.setFixedHeight(60)
        # Create the QML user interface.
        view = QDeclarativeView()
        view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
        view.setSource(ui_tools.get_qml_resource("Notification.qml"))
        self._root = view.rootObject()
        vbox = QVBoxLayout(self)
        vbox.addWidget(view)

        self.connect(self._root, SIGNAL("close()"), self.close)
예제 #11
0
    def __init__(self):
        QWidget.__init__(self)
        box = QVBoxLayout(self)
        box.setContentsMargins(0, 0, 0, 0)
        view = QDeclarativeView()
        view.setMinimumSize(400, 400)
        qml = os.path.join(paths.PATH, "ui", "StartPage.qml")
        path = QDir.fromNativeSeparators(qml)
        view.setSource(QUrl.fromLocalFile(path))
        view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
        self._root = view.rootObject()
        box.addWidget(view)

        self._current_text = ""
        # Timer
        self.timer = QTimer(self)
        self.timer.setInterval(3000)
        self._show_welcome_text()
        self.timer.timeout.connect(self._show_text)
        self.timer.start()
예제 #12
0
    def __init__(self, parent=None):
        super(SplitOrientation,
              self).__init__(parent, Qt.Dialog | Qt.FramelessWindowHint)
        self._operations = {'row': False, 'col': True}
        self.setModal(True)
        self.setAttribute(Qt.WA_TranslucentBackground)
        self.setStyleSheet("background:transparent;")
        self.setFixedHeight(150)
        self.setFixedWidth(290)
        # Create the QML user interface.
        view = QDeclarativeView()
        view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
        view.setSource(ui_tools.get_qml_resource("SplitOrientation.qml"))
        self._root = view.rootObject()
        vbox = QVBoxLayout(self)
        vbox.setContentsMargins(0, 0, 0, 0)
        vbox.setSpacing(0)
        vbox.addWidget(view)

        self.connect(self._root, SIGNAL("selected(QString)"),
                     self._split_operation)
예제 #13
0
    def __init__(self, parent=None):
        super(AddFileFolderWidget,
              self).__init__(parent, Qt.Dialog | Qt.FramelessWindowHint)
        self._main_container = parent
        self.setModal(True)
        self.setAttribute(Qt.WA_TranslucentBackground)
        self.setStyleSheet("background:transparent;")
        self.setFixedHeight(70)
        self.setFixedWidth(650)
        # Create the QML user interface.
        self.view = QDeclarativeView()
        self.view.setResizeMode(QDeclarativeView.SizeRootObjectToView)
        self.view.setSource(ui_tools.get_qml_resource("AddFileFolder.qml"))
        self._root = self.view.rootObject()
        vbox = QVBoxLayout(self)
        vbox.setContentsMargins(0, 0, 0, 0)
        vbox.setSpacing(0)
        vbox.addWidget(self.view)

        self._base_path = ""

        self._create_file_operation = True

        self.connect(self._root, SIGNAL("create(QString)"), self._create)
예제 #14
0
# requested.
class Now(QObject):

    now = QtCore.pyqtSignal(str)

    def emit_now(self):
        formatted_date = QDateTime.currentDateTime().toString()
        self.now.emit(formatted_date)


app = QApplication(sys.argv)

now = Now()

# Create the QML user interface.
view = QDeclarativeView()
view.setSource(QUrl('message.qml'))
view.setResizeMode(QDeclarativeView.SizeRootObjectToView)

# Get the root object of the user interface.  It defines a
# 'messageRequired' signal and JavaScript 'updateMessage' function.  Both
# can be accessed transparently from Python.
rootObject = view.rootObject()

# Provide the current date and time when requested by the user interface.
rootObject.messageRequired.connect(now.emit_now)

# Update the user interface with the current date and time.
now.now.connect(rootObject.updateMessage)

# Provide an initial message as a prompt.
예제 #15
0
    def __init__(self, parent=None):
        super(SleepTimer, self).__init__(parent)
        self.forceSpinBoxWidget = global_vars.configuration.get("GENERAL").get(
            "sleeptimerdigitalspinbox")
        self.setStyleSheet(
            "SleepTimer {"
            "background-color: rgb(76, 76, 76);"
            "color: rgb(240, 240, 240);"
            "}"
            "QLabel {"
            "color: white;"
            "}"
            "QSpinBox {"
            "padding-right: 10px; /* make room for the arrows */"
            "border-width: 3;"
            "}"
            "QSpinBox::up-button {"
            "width: 26px;"
            "}"
            "QSpinBox::down-button {"
            "width: 26px;"
            "}")
        self.value = 0  # the value is calculated in self.active (calculated seconds in total)
        self.isActive = False

        if self.forceSpinBoxWidget:
            self.sb_hours = LeadingZeroSpinBox()
            self.sb_hours.setRange(0, 23)
            self.sb_hours.setAlignment(Qt.AlignCenter)
            self.sb_hours.setSizePolicy(QSizePolicy.Expanding,
                                        QSizePolicy.Expanding)
        else:
            self.sb_hours = QDeclarativeView()
            self.sb_hours.setSource(QUrl(os.path.join(cwd, 'sb_hours.qml')))
            self.sb_hours.setResizeMode(QDeclarativeView.SizeViewToRootObject)
            self.sb_hours.setStyleSheet("background:transparent;")
            self.sb_hours.setSizePolicy(QSizePolicy.Expanding,
                                        QSizePolicy.Expanding)

            self.sb_hours_obj = self.sb_hours.rootObject().findChild(
                QObject, "spinner")
            self.sb_hours_value = QDeclarativeProperty(
                self.sb_hours.rootObject().findChild(QDeclarativeItem,
                                                     name="spinner"),
                "currentIndex")

        if self.forceSpinBoxWidget:
            self.sb_minutes = LeadingZeroSpinBox()
            self.sb_minutes.setRange(0, 59)
            self.sb_minutes.setAlignment(Qt.AlignCenter)
            self.sb_minutes.setSizePolicy(QSizePolicy.Expanding,
                                          QSizePolicy.Expanding)
        else:
            self.sb_minutes = QDeclarativeView()
            self.sb_minutes.setSource(QUrl(os.path.join(cwd,
                                                        'sb_minutes.qml')))
            self.sb_minutes.setResizeMode(
                QDeclarativeView.SizeViewToRootObject)
            self.sb_minutes.setStyleSheet("background:transparent;")
            self.sb_minutes.setSizePolicy(QSizePolicy.Expanding,
                                          QSizePolicy.Expanding)

            self.sb_minutes_obj = self.sb_minutes.rootObject().findChild(
                QObject, "spinner")
            self.sb_minutes_value = QDeclarativeProperty(
                self.sb_minutes.rootObject().findChild(QDeclarativeItem,
                                                       name="spinner"),
                "currentIndex")

        tmpFont = QFont()
        tmpFont.setPointSize(18)
        self.lbl_hours = QLabel(QString("h"))
        self.lbl_hours.setFont(tmpFont)
        self.lbl_minutes = QLabel(QString("min"))
        self.lbl_minutes.setFont(tmpFont)

        # Load QML Widget Bomb
        self.bomb = QDeclarativeView()
        self.bomb.setSource(QUrl(os.path.join(cwd, 'timebomb.qml')))
        self.bomb.setResizeMode(QDeclarativeView.SizeViewToRootObject)
        #self.bomb.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.bomb.setStyleSheet("background:transparent;")
        self.bomb_text = QDeclarativeProperty(
            self.bomb.rootObject().findChild(QDeclarativeItem,
                                             name="counter_text"), "text")

        #setup layouts
        tmpLayout = QHBoxLayout()
        tmpLayout.addSpacerItem(QSpacerItem(40, 40, QSizePolicy.Expanding))
        tmpLayout.addWidget(self.sb_hours)
        tmpLayout.addWidget(self.lbl_hours)
        tmpLayout.addWidget(self.sb_minutes)
        tmpLayout.addWidget(self.lbl_minutes)
        tmpLayout.addSpacerItem(QSpacerItem(40, 40, QSizePolicy.Expanding))

        tmp2Layout = QVBoxLayout()
        tmp2Layout.addLayout(tmpLayout)
        tmp2Layout.addWidget(self.bomb)
        tmp2Layout.addSpacerItem(QSpacerItem(40, 40, QSizePolicy.Expanding))

        self.setLayout(tmp2Layout)
        self.blockValueSignal = False  # if this is true, valueChanged signal is not evaluated
        if self.forceSpinBoxWidget:
            self.sb_hours.valueChanged.connect(self.onValueChanged)
            self.sb_minutes.valueChanged.connect(self.onValueChanged)
        else:
            self.sb_hours_obj.currentIndexChanged.connect(self.onValueChanged)
            self.sb_minutes_obj.currentIndexChanged.connect(
                self.onValueChanged)

        # setup Timer which is started as soon as a value is changed in any of the spinboxes
        self.timer = QTimer()
        self.timer.setSingleShot(True)
        self.timer.setInterval(
            2000)  # 2 seconds until timer starts automatically
        self.connect(self.timer, SIGNAL("timeout()"), self.activate)

        #setup Timer which is a second-timer. It is startet with the self.timer (see self.active)
        self.countDown = QTimer()
        self.countDown.setInterval(1000)  #sec
        self.connect(self.countDown, SIGNAL("timeout()"), self.check)