コード例 #1
0
    def __init__(self):
        # Collect events until released
        self.keyboard = KeyboardController()
        self.ori_x = 0
        self.ori_y = 0
        self.t1 = time.time()

        self.src = ''
        self.last_append = ''
        self.result = ''

        self.is_word = False
        self.config = Config(self)
        self.config.load()
        self.lang = LanguageManager(self.config['language'])
        self.taskbar = TaskBarIcon(self)
        self.mainFrame = MainFrame(self)
        self.subFrame = FocusFrame(self)
        self.writingFrame = WritingFrame(self)
        self.stored_source = self.source
        self.config.initialize()

        self.mainFrame.Centre()
        # self.mainFrame.Show()
        self.patterns = [
            re.compile(r'([?!.])[ ]?\n'),
            re.compile(r'([?!。])[ \n]')
        ]  # 前面一个处理英语语系的,后面一个可以处理汉语系。
        self.pattern2 = re.compile(r'\$([??!!.。])\$')

        UpdateThread(self).start()
コード例 #2
0
ファイル: taskbar.py プロジェクト: hiandy168/CopyTranslator
 def OnAbout(self, event):
     # wx.MessageBox('copyTranslator v0.0.5.2 by Elliott Zheng\nProject website: https://github.com/elliottzheng/CopyTranslator',
     #               'About')
     UpdateThread(self.setting).start()
     box = wx.MessageDialog(self.setting.mainFrame if self.setting.is_main else self.setting.subFrame,
                            'If you found it useful, please give me a star on GitHub or introduce to your friend.\n\n如果您感觉本软件对您有所帮助,请在项目Github上给个star或是介绍给您的朋友,谢谢。',
                            project_name + ' ' + version + ' by Elliott Zheng', wx.YES_NO | wx.ICON_QUESTION)
     answer = box.ShowModal()
     if answer == wx.ID_YES:
         webbrowser.open(project_url)
     box.Destroy()
コード例 #3
0
ファイル: taskbar.py プロジェクト: reiwu/CopyTranslator-1
 def OnAbout(self, event):
     UpdateThread(self.setting).start()
     box = wx.MessageDialog(
         self.setting.get_current_frame(),
         'If you found it useful, please give me a star on GitHub or introduce to your friend.\n\n如果您感觉本软件对您有所帮助,请在项目Github上给个star或是介绍给您的朋友,谢谢。\n\n本软件免费开源,如果您是以付费的方式获得本软件,那么你应该是被骗了。[○・`Д´・ ○]\n\n前往软件官网?',
         project_name + ' ' + version + ' by Elliott Zheng',
         wx.YES_NO | wx.ICON_QUESTION)
     answer = box.ShowModal()
     if answer == wx.ID_YES:
         webbrowser.open(project_url)
     box.Destroy()
コード例 #4
0
ファイル: setting.py プロジェクト: hiandy168/CopyTranslator
    def __init__(self):
        # Collect events until released
        self.mouseListener = mouse.Listener(on_click=self.onLongClick)
        self.keyboard = Controller()
        self.ori_x = 0
        self.ori_y = 0
        self.t1 = time.time()

        self._default_value = {
            'author': 'Elliott Zheng',
            'version': version,
            'is_listen': False,
            'is_copy': False,
            'is_dete': False,
            'stay_top': True,
            'continus': False,
            'smart_dict': True,
            'is_main': True,
            'pixel_size': 15,
            'source': 'english',
            'target': 'chinese (simplified)',
            'last_ask': 0
        }
        self.value = self._default_value
        self.filepath = os.path.expanduser('~/copytranslator.json')
        self.load()

        self.taskbar = TaskBarIcon(self)
        self.mainFrame = MainFrame(self)
        self.subFrame = SubFrame(self)

        self.mainFrame.Centre()
        # self.mainFrame.Show()
        self.state = MyPanel.NOT_LISTEN
        self.translator = Translator(service_urls=['translate.google.cn'])
        self.youdao_dict = YoudaoSpider()
        self.src = ''
        self.last_append = ''
        self.result = ''
        self.patterns = [
            re.compile(r'([?!.])[ ]?\n'),
            re.compile(r'([?!。])[ \n]')
        ]  # 前面一个处理英语语系的,后面一个可以处理汉语系。
        self.pattern2 = re.compile(r'\$([??!!.。])\$')
        self.is_word = False
        self.initialize()
        UpdateThread(self).start()