Example #1
0
    def run(self):
        '''运行并显示窗口'''
        self.mainWindow.move(*self._position)
        # 输入结束信号连接run槽
        self.ui.lineEdit.editingFinished.connect(self.call_action)
        # 重写keyPressEvent
        self.ui.lineEdit.keyPressEvent = self.keypressevent(
            self.ui.lineEdit.keyPressEvent)
        # 去除顶栏 和 一直在顶部
        self.mainWindow.setWindowFlags(QtCore.Qt.FramelessWindowHint
                                       | QtCore.Qt.WindowStaysOnTopHint)

        self._getconfig()
        self._loadconfig()
        self._writeconfig()

        pyperclip.determine_clipboard()
        keybinder.init()
        keybinder.register_hotkey(self.mainWindow.winId(), "Shift+Ctrl+A",
                                  self.callback)
        keybinder.register_hotkey(self.mainWindow.winId(), "Shift+Ctrl+E",
                                  self.mainWindow.close)

        win_event_filter = WinEventFilter(keybinder)
        event_dispatcher = QtCore.QAbstractEventDispatcher.instance()
        event_dispatcher.installNativeEventFilter(win_event_filter)

        sys.exit(self.app.exec_())
        keybinder.unregister_hotkey(self.mainWindow.winId(), "Shift+Ctrl+A")
        keybinder.unregister_hotkey(self.mainWindow.winId(), "Shift+Ctrl+F")
Example #2
0
 async def Input__paste(tabs, tab, data):
     try:
         backup = pyperclip.determine_clipboard()[1](
         )  # Not sure if is correct D:
     except:
         backup = None
     pyperclip.copy(data)
     await tab.Input.press_key(tabs.helpers.keyboard.PASTE)
     if backup is not None:
         pyperclip.copy(backup)
Example #3
0
            "Precio Gases licuados del petróleo")
        self.precio_gasoleo_a = kwargs.get("Precio Gasoleo A")
        self.precio_gasoleo_b = kwargs.get("Precio Gasoleo B")
        self.precio_gasolina_95_proteccion = kwargs.get(
            "Precio Gasolina 95 Protección")
        self.precio_gasolina_98 = kwargs.get("Precio Gasolina  98")
        self.precio_nuevo_gasoleo_a = kwargs.get("Precio Nuevo Gasoleo A")
        self.bio_etanol = kwargs.get("% BioEtanol")
        self.ester_metilico = kwargs.get("% Éster metílico")


if __name__ == '__main__':
    import pyperclip as clip
    import json

    copy, paste = clip.determine_clipboard()
    clip_content = paste().strip(' ,\n[]\r\t')
    if clip_content is None or not len(clip_content):
        clip_content = '{}'
    try:
        params = json.loads(clip_content.replace("'", '"'))
        params = list(params)
        class_name = 'Incidencia'
        ident = ' ' * 12

        code = f"""
    class {class_name}(Base):
        \"\"\"Clase modelo para {class_name.lower()}.\"\"\"

        def __init__(self):
            super().__init__(**locals())
Example #4
0
import pyperclip

copy_text, paste_text = pyperclip.determine_clipboard()

unavailable = any(
    isinstance(func, object) and type(func).__name__ == 'ClipboardUnavailable'
    for func in locals().values())

if unavailable:
    del copy_text
    del paste_text