Exemplo n.º 1
0
    def __init__(self, title='Popup', message='', params={}, parent=None):
        QtGui.QWidget.__init__(self, parent)

        width = 300
        height = 200

        resolution = QDesktopWidget().screenGeometry()
        self.setGeometry(resolution.width() - width, resolution.height() - height, width, height)

        pos_x = resolution.width() / 2 - width / 2
        pos_y = resolution.height() / 2 - height / 2
        self.move(pos_x, pos_y)

        self.setWindowTitle(title)
        self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowStaysOnTopHint)

        self.setToolTip(title)
        self.setObjectName("toolTipWindow")
        self.setStyleSheet(Resources.read(join('assets', 'styles', 'tooltip.pss')))

        self.CComamnd = QtGui.QLabel(message)
        #self.CComamnd.setFixedHeight(50)
        self.CComamnd.setAlignment(QtCore.Qt.AlignTop | QtCore.Qt.AlignLeft)
        self.CComamnd.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
        self.CComamnd.setObjectName('command')

        layout = QtGui.QVBoxLayout()
        layout.addWidget(self.CComamnd)
        self.setLayout(layout)
        QtGui.QToolTip.setFont(QtGui.QFont('OldEnglish', 10))
        self.show()
Exemplo n.º 2
0
    def __init__(self, title='Try To Learn', id=0, sentence='', translate='', parent=None):
        QtGui.QWidget.__init__(self, parent)

        #self.setGeom(500, 200)
        self.resize(self.sizeHint())
        #self.resize(self.sizeHint())

        self.setWindowTitle(str(id) + ': ' + sentence)
        self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowStaysOnTopHint)
        # self.setWindowFlags(QtCore.Qt.Popup)
        self.setAttribute(QtCore.Qt.WA_ShowWithoutActivating)

        self.setToolTip(title)
        self.setObjectName("toolTipWindow")
        self.setStyleSheet(Resources.read(join('assets', 'styles', 'tooltip.pss')))

        self.setLeftPanel(translate + ' - ')
        self.setRightPanel(sentence)

        layout = QtGui.QGridLayout()
        layout.addWidget(self.leftText, 0, 0, 1, 1)
        layout.addWidget(self.rightText, 0, 1)
        self.setLayout(layout)
        QtGui.QToolTip.setFont(QtGui.QFont('OldEnglish', 10))

        self.show()
        self.raise_()

        #self.resizeAfterShow()
        self.moveAfterShow()
Exemplo n.º 3
0
    def __init__(self, title='Popup', message='', params={}, parent=None):
        QtGui.QWidget.__init__(self, parent)

        width = 300
        height = 200

        resolution = QDesktopWidget().screenGeometry()
        self.setGeometry(resolution.width() - width,
                         resolution.height() - height, width, height)

        pos_x = resolution.width() / 2 - width / 2
        pos_y = resolution.height() / 2 - height / 2
        self.move(pos_x, pos_y)

        self.setWindowTitle(title)
        self.setWindowFlags(self.windowFlags()
                            | QtCore.Qt.WindowStaysOnTopHint)

        self.setToolTip(title)
        self.setObjectName("toolTipWindow")
        self.setStyleSheet(
            Resources.read(join('assets', 'styles', 'tooltip.pss')))

        self.CComamnd = QtGui.QLabel(message)
        #self.CComamnd.setFixedHeight(50)
        self.CComamnd.setAlignment(QtCore.Qt.AlignTop | QtCore.Qt.AlignLeft)
        self.CComamnd.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
        self.CComamnd.setObjectName('command')

        layout = QtGui.QVBoxLayout()
        layout.addWidget(self.CComamnd)
        self.setLayout(layout)
        QtGui.QToolTip.setFont(QtGui.QFont('OldEnglish', 10))
        self.show()
Exemplo n.º 4
0
    def __init__(self, *args):
        QWidget.__init__(self, *args)
        self.setWindowIcon(QIcon("assets/images/icon.png"))

        # create objects
        self.TextPanel = QLabel("\nHi! Have a nice day!")

        self.TextPanel.setAlignment(Qt.AlignBottom | Qt.AlignLeft)
        self.TextPanel.setContentsMargins(15, 10, 10, 10)
        self.TextPanel.setTextInteractionFlags(Qt.TextSelectableByMouse)
        self.CLineEdit = CLineEdit()

        self.setObjectName("Window")
        self.CLineEdit.setObjectName("inputCommand")
        self.TextPanel.setObjectName("commandBox")
        self.setStyleSheet(Resources.readStyleSheet('window.pss'))

        rightPanel = QGridLayout()
        buttonGetConf = QPushButton("Get Conf")
        buttonPushConf = QPushButton("Push Conf")

        buttonGetConfFromFolder = QPushButton("Copy Conf from `conf`")
        buttonCopyConfToFolder = QPushButton("Copy Conf` to `conf`")

        buttonCopyPemFromFolder = QPushButton("Copy pems from folder")
        buttonGetPemsFromDrive = QPushButton("Get pems from drive")
        buttonPushPemsToDrive = QPushButton("Push pems to drive")


        rightPanel.addWidget(buttonGetConf)
        rightPanel.addWidget(buttonPushConf)
        rightPanel.addWidget(buttonGetConfFromFolder)
        rightPanel.addWidget(buttonCopyConfToFolder)
        rightPanel.addWidget(buttonCopyPemFromFolder)
        rightPanel.addWidget(buttonGetPemsFromDrive)
        rightPanel.addWidget(buttonPushPemsToDrive)

        # layout
        layout = QGridLayout()
        self.TextPanel.setFixedHeight(250)

        layout.addWidget(self.TextPanel, 0, 0, 1, 1)
        layout.addWidget(self.CLineEdit, 1, 0)
        layout.addLayout(rightPanel, 0, 1)

        self.setLayout(layout)
        self.command = Command()

        self.db = DBLite()
        self.db.start()

        # connections
        self.connect(self.CLineEdit, SIGNAL("enterPressed"), self.inputCommandExecute)
        self.connect(self.CLineEdit, SIGNAL("ctrlSpacePressed"), self.deactivate)
        self.connect(self.TextPanel, SIGNAL("linkActivated(QString)"), self.OpenURL)
        self.connect(self.command, SIGNAL("updateCommandTextBox(PyQt_PyObject, PyQt_PyObject)"), self.updateCommandTextBox)
        self.connect(self.db, SIGNAL("showSentencePopup(PyQt_PyObject, PyQt_PyObject, PyQt_PyObject)"), self.showSentencePopup)
Exemplo n.º 5
0
    def static(self, command):
        if 'https://github.com/' in command:
            conf = Resources.Settings('github')
            command = command.replace(
                'https://github.com/', 'https://' + conf['login'] + ':' +
                conf['pass'] + '@github.com/')
            self.copy(command)
            return command

        if 'https://bitbucket.org' in command:
            conf = Resources.Settings('bitbucket')
            command = command.replace(
                'https://bitbucket.org', 'https://' + conf['login'] + ':' +
                conf['pass'] + '@bitbucket.org')
            self.copy(command)
            return command

        if 'create' in command:
            args = ParseCommandArguments(command).parse()
            try:
                Create(args)
            except Exception, e:
                return str(e)
Exemplo n.º 6
0
    def __init__(self, *args):
        QWidget.__init__(self, *args)
        self.setWindowIcon(QIcon("assets/images/icon.png"))

        # create objects
        self.TextPanel = QLabel("\nHi! Have a nice day!")

        self.TextPanel.setAlignment(Qt.AlignBottom | Qt.AlignLeft)
        self.TextPanel.setContentsMargins(15, 10, 10, 10)
        self.TextPanel.setTextInteractionFlags(Qt.TextSelectableByMouse)
        self.CLineEdit = CLineEdit()

        self.setObjectName("Window")
        self.CLineEdit.setObjectName("inputCommand")
        self.TextPanel.setObjectName("commandBox")
        self.setStyleSheet(Resources.readStyleSheet('window.pss'))

        rightPanel = QGridLayout()
        buttonGetConf = QPushButton("Get Conf")
        buttonPushConf = QPushButton("Push Conf")

        buttonGetConfFromFolder = QPushButton("Copy Conf from `conf`")
        buttonCopyConfToFolder = QPushButton("Copy Conf` to `conf`")

        buttonCopyPemFromFolder = QPushButton("Copy pems from folder")
        buttonGetPemsFromDrive = QPushButton("Get pems from drive")
        buttonPushPemsToDrive = QPushButton("Push pems to drive")

        rightPanel.addWidget(buttonGetConf)
        rightPanel.addWidget(buttonPushConf)
        rightPanel.addWidget(buttonGetConfFromFolder)
        rightPanel.addWidget(buttonCopyConfToFolder)
        rightPanel.addWidget(buttonCopyPemFromFolder)
        rightPanel.addWidget(buttonGetPemsFromDrive)
        rightPanel.addWidget(buttonPushPemsToDrive)

        # layout
        layout = QGridLayout()
        self.TextPanel.setFixedHeight(250)

        layout.addWidget(self.TextPanel, 0, 0, 1, 1)
        layout.addWidget(self.CLineEdit, 1, 0)
        layout.addLayout(rightPanel, 0, 1)

        self.setLayout(layout)
        self.command = Command()

        self.db = DBLite()
        self.db.start()

        # connections
        self.connect(self.CLineEdit, SIGNAL("enterPressed"),
                     self.inputCommandExecute)
        self.connect(self.CLineEdit, SIGNAL("ctrlSpacePressed"),
                     self.deactivate)
        self.connect(self.TextPanel, SIGNAL("linkActivated(QString)"),
                     self.OpenURL)
        self.connect(
            self.command,
            SIGNAL("updateCommandTextBox(PyQt_PyObject, PyQt_PyObject)"),
            self.updateCommandTextBox)
        self.connect(
            self.db,
            SIGNAL(
                "showSentencePopup(PyQt_PyObject, PyQt_PyObject, PyQt_PyObject)"
            ), self.showSentencePopup)
Exemplo n.º 7
0
from components.Resources import Resources
import handler
import service
import sys

settings = Resources.Settings('Lingualeo')

email = settings["email"]
password = settings["password"]

if export_type == 'text':
    word_handler = handler.Text(config.sources.get('text'))
elif export_type == 'kindle':
    word_handler = handler.Kindle(config.sources.get('kindle'))
else:
    raise Exception('unsupported type')

word_handler.read()

lingualeo = service.Lingualeo(email, password)
lingualeo.auth()
translate = lingualeo.get_translates('already')

if translate["is_exist"]:
    print "Already exists: " + word.strip()
else:
    context = word_dto.context.encode('utf-8')
    lingualeo.add_word(word, translate["tword"], context)
    print "Add word: " + word.strip()

for word_dto in word_handler.get():