def run(self) -> None:
     try:
         self.__threadLock.acquire()
         self.__window.statusBar.SetStatusText("正在检查更新...", 2)
         self.__threadLock.release()
         newInfo = FetchNewVersion()
         newVersion = LooseVersion(newInfo['version'])
         currentVersion = LooseVersion(Settings.version())
         self.__threadLock.acquire()
         Settings.settings["lastCheckUpdateTime"] = Now()
         if currentVersion < newVersion:
             MessageBox("当前版本为%s, 检查到新版本%s" %
                        (Settings.version(), newInfo["version"]))
             if newInfo["registry"]["type"] == "list":
                 LaunchDefaultBrowser(newInfo["registry"]["url"])
             self.__window.statusBar.SetStatusText(
                 "检查到新版本" + newInfo['version'], 2)
         else:
             self.__window.statusBar.SetStatusText("当前版本为最新版本", 2)
         self.__threadLock.release()
     except Exception as e:
         self.__window.statusBar.SetStatusText("", 2)
         self.__threadLock.acquire()
         self.__window.statusBar.SetStatusText("检查更新出错", 2)
         MessageBox(str(e), "检查更新时出现错误", ICON_ERROR)
         self.__threadLock.release()
Beispiel #2
0
 def SetRuby(self, e=None, *, ruby_=None):
     slc = self.editor.GetSelection()
     if slc[0] == slc[1]:
         MessageBox("選択されたテキストがありません", "エラー", style=OK)
         return
     if not ruby_:
         dialog = TextEntryDialog(None, "振り仮名を入力してください", "振り仮名を設定")
         if dialog.ShowModal() == ID_CANCEL:
             return
         dialog.Destroy()
         res = dialog.GetValue()
         if not res:
             MessageBox("空欄にはできません", "エラー", style=OK)
             return
     else:
         res = ruby_
     tmp = self.editor.GetValue()
     if linesep == "\r\n":
         newlines = tmp[:slc[0]].count("\n")
     else:
         newlines = 0
     slc = slc[0] - newlines, slc[1] - newlines
     tmp = tmp[:slc[0]], tmp[slc[0]:slc[1]], tmp[slc[1]:]
     if linesep in tmp[1]:
         MessageBox("改行を挟むことはできません。", "エラー", style=OK)
     self.editor.SetValue(tmp[0] + f"|{tmp[1]}《{res}》" + tmp[2])
     self.editor.SetInsertionPoint(slc[1] + newlines + len(res) + 3)
Beispiel #3
0
 def OnButtonClicked(self, event):
     if event.GetId() == self.cancelButton.GetId():
         self.Close()
         return
     name = self.nameInput.GetValue()
     url = self.urlInput.GetValue()
     isOnline = self.onlineRadio.GetValue()
     if not isOnline:
         url = None
     if not name or len(name) < 1:
         MessageBox("请输入Hosts名称", "提示", ICON_WARNING)
     elif isOnline and (not url or len(url) < 1):
         MessageBox("请输入在线Hosts地址", "提示", ICON_WARNING)
     else:
         if not self.iconComboBox.GetValue():
             self.iconComboBox.SetValue("logo")
         if self.__hosts:
             self.__hosts["name"] = name
             self.__hosts["url"] = url
             self.__hosts["lastUpdateTime"] = Now()
             self.__hosts["icon"] = self.iconComboBox.GetValue()
             hostsId = self.__hosts['id']
         else:
             hostsId = 0x1994 + len(Settings.settings["hosts"])
             Settings.settings["hosts"].append(
                 hostsDict(hostsId,
                           name,
                           url=url,
                           lastUpdateTime=Now(),
                           content="# Created by mHosts v%s, %s\n" %
                           (Settings.version(), Now()),
                           icon=self.iconComboBox.GetValue()))
         Settings.Save()
         self.__window.InitHostsTree(select=hostsId)
         self.Close()
Beispiel #4
0
    def loadata(self, Acod):
        #print Acod
        data = self.iMolk.Amlak4(" where Molks.Acc = %s " % Acod)
        #self.lstrow = []
        if data == []:
            mydlg = MyDialog2(self)
            mydlg.ShowModal()
            #print 'Archive it',mydlg.Acarv
            #print 'Delete it',mydlg.Acdel
            mydlg.Destroy()
            if mydlg.Acdel:
                self.myact = 'Delete it'
                self.delacc(Acod)
                MessageBox(u'مشتري بکلي حذف شد', u'اعلان',
                           OK | ICON_INFORMATION)

            if mydlg.Acarv:
                self.myact = 'Archive it'
                self.arcacc(Acod)
                MessageBox(u'اطلاعات مشتري آرشيو و حذف شد', u'اعلان',
                           OK | ICON_INFORMATION)

        else:
            for d in data:
                if d[2] == u'0':
                    DD = u'سه خوابه'
                if d[2] == u'1':
                    DD = u'دو خوابه'
                if d[2] == u'2':
                    DD = u'يک خوابه'
                d = (self.inum.Digigrop(d[0], ','), self.inum.e2f(d[1]), DD,
                     self.inum.e2f(d[3]), self.inum.e2f(d[4]),
                     self.inum.e2f(d[5]), d[6], d[7], d[8],
                     self.inum.e2f(d[9]))
                self.DVLC1.AppendItem(d)
Beispiel #5
0
    def on_send_message_sms(self):
        'Invoked when enter is pressed in the message input box during SMS mode.'

        # Early exit if there is no message to send.
        if not self.input_area.Value: return

        to, frm = self.SMSControl.ToSMS, self.SMSControl.FromAccount
        if to is None:
            MessageBox(_('Please add an SMS number first.'),
                       _('Send SMS Message'))
        elif frm is None:
            MessageBox(
                _('You are not signed in to any accounts which can send SMS messages.'
                  ), _('Send SMS Message'))
        else:

            message = self.input_area.Value

            def on_success():
                self.show_message(
                    Message(buddy=frm.self_buddy,
                            message=message[:SMS_MAX_LENGTH],
                            conversation=self.convo,
                            type='outgoing'))
                self.ClearAndFocus()

            def on_error(errstr=None):
                if errstr is not None:
                    more = '\n' + _(
                        'The error message received was:') + '\n\t%s' % errstr
                else:
                    more = ''

                MessageBox(
                    _('There was an error in sending your SMS message.') +
                    more,
                    _('Send SMS Message Error'),
                    style=wx.ICON_ERROR)

            # Check the length--even though we limit the number of characters in SMS mode, the input box
            # may already have had too many characters.
            if len(message) > SMS_MAX_LENGTH:
                sms_line1 = _(
                    'Only the first {max_length:d} characters of your message can be sent over SMS:'
                ).format(max_length=SMS_MAX_LENGTH)
                sms_line2 = _('Do you want to send this message now?')

                if wx.NO == wx.MessageBox(u'%s\n\n"%s"\n\n%s' %
                                          (sms_line1, message, sms_line2),
                                          _('Send SMS - Character Limit'),
                                          style=wx.YES_NO):
                    return

            import hooks
            hooks.notify('digsby.statistics.sms.sent')
            frm.send_sms(to,
                         message[:SMS_MAX_LENGTH],
                         success=on_success,
                         error=on_error)
Beispiel #6
0
 def chkacc(self):
     if self.iMolk.gAccn(self.fld1.GetValue()) != []:
         MessageBox(u'جهت اصلاح نام يا شماره تلفن به بخش اصلاحات برويد',
                    u'خطا', OK | ICON_WARNING)
         return 0
     if self.iMolk.gAccd(self.fld0.GetValue()) != []:
         MessageBox(u'کد تکراري است کد جديد انتخاب کنيد', u'خطا',
                    OK | ICON_WARNING)
         return 0
     return 1
Beispiel #7
0
 def waitKey(umlFrame: DiagramFrame, optionalMessage: str = None):
     # input('Press enter to continue')
     if optionalMessage is None:
         MessageBox('Press Ok to continue', 'Confirm', style=OK | CENTRE)
     else:
         MessageBox(optionalMessage,
                    'Press Ok to continue',
                    style=OK | CENTRE)
     umlFrame.Refresh()
     wxYield()
Beispiel #8
0
	def chkin( self ):
                if self.fld1.GetValue() == u'':
                        MessageBox(u'نام بنگاه را مشخص کنيد',u'خطا',OK | ICON_WARNING)
                        return 0
                if self.fld2.GetValue() == u'':
                        MessageBox(u'عملکرد بنگاه را مشخص کنيد',u'خطا',OK | ICON_WARNING)
                        return 0
                if not self.nwb:
                        MessageBox(u'بنگاه قبلا ثبت شده',u'خطا',OK | ICON_WARNING)
                        return 0
                return 1
Beispiel #9
0
	def takit( self, event ):
                #print self.chkghbz()
                if self.chkghbz() == 1:
                        idata = self.Getdata()
                        self.SetData(idata)
                        if self.isnd == 1:
                                import Database.insnd2 as IS
                                IS.Input2_Document(idata)
                                MessageBox(u'درآخرين سند ثبت شد',u'اعلان',OK | ICON_INFORMATION)
                        MessageBox(u'قبض با موفقيت ثبت شد',u'اعلان',OK | ICON_INFORMATION)
                        q = self.GetParent()
                        q.Close()
Beispiel #10
0
    def bakup(self, event):
        d = JalaliDatetime().now()
        self.s = str(d.year) + str(d.month) + str(d.day) + str(d.hour) + str(
            d.minute) + str(d.second)

        Path = self.file1.GetPath()
        with zipfile.ZipFile(Path + SLASH + "bac" + self.s + ".zip",
                             "w") as izip:
            izip.write(DATABASE_PATH + "Molk.db")
            izip.write(DATABASE_PATH + "ABR.db")
            izip.write(DATABASE_PATH + "Company.db")

        tar = tarfile.open(TEMPS_PATH + "bac" + self.s + ".tar", "w")
        tar.add(DATABASE_PATH + "Molk.db")
        tar.add(DATABASE_PATH + "ABR.db")
        tar.add(DATABASE_PATH + "Company.db")
        tar.close()

        self.getdata()
        self.recdb()
        MessageBox(u'پشتيباني با موفقيت انجام شد', u'اعلان',
                   OK | ICON_INFORMATION)

        q = self.GetParent()
        q.Close()
Beispiel #11
0
def BaseCheck():
    #Check Main file is
    try:
        s = os.fstat(os.open(DATABASE_PATH + 'Main.db', os.O_RDONLY))
        #print 'ok'
    except:
        #print DATABASE_PATH
        MessageBox(
            u'хгД≤ гьАгзгйМ │Мог ДЦМ тФо Мг йняМх тоЕ хЕ хнт хгрМгхМ гьАгзгй хяФМо',
            u'ньг', OK | ICON_WARNING)
    finally:
        ichk = DG.GetData(u'', u'')
        Dcheck = ichk.gCmpny()

        #print Dcheck
        if Dcheck == []:
            #Startpro()
            return ['', '']
        else:
            irev = ichk.lsrev(Dcheck[0][0])
            #print irev
            #lrev = []
            #for i in range(len(irev)):
            #    lrev.append(irev[i][0])
            #Checkdatatime(Dcheck,now)
            return [Dcheck[0][1], irev[0][0]]
Beispiel #12
0
 def Post(self, e):
     if len(self.editor.GetValue()) < 10:
         MessageBox("投稿するためには10文字以上必要です。", "エラー", style=OK)
         return
     dialog = TextEntryDialog(None, "小説のタイトルを設定してください", "小説タイトルを設定")
     dialog.ShowModal()
     dialog.Destroy()
     try:
         self.stat.SetStatusText("投稿中...", 1)
         send(dialog.GetValue(), self.editor.GetValue(), load_config(),
              self._sent)
     except ValueError as err:
         MessageBox(str(err), "エラー", style=OK)
         return
     except Canceled:
         return
Beispiel #13
0
    def read(self, oglObjects, umlFrame: UmlClassDiagramsFrame):
        """
        Reverse engineering

        Args:
            oglObjects:     list of imported objects
            umlFrame:       Pyut's UmlFrame
        """
        # Ask the user which destination file he wants
        # directory=self._askForDirectoryImport()
        # if directory=="":
        #    return False
        (lstFiles, directory) = self._askForFileImport(True)
        if len(lstFiles) == 0:
            return False

        BeginBusyCursor()
        wxYield()
        try:
            reverseEngineer: ReverseEngineerPython2 = ReverseEngineerPython2()
            reverseEngineer.reversePython(umlFrame=umlFrame,
                                          directoryName=directory,
                                          files=lstFiles)
            # TODO: Don't expose the internals
            self.logger.debug(
                f'classNames: {jsonDumps(reverseEngineer.visitor.classMethods, indent=4)}'
            )
            self.logger.debug(
                f'methods: {jsonDumps(reverseEngineer.visitor.parameters, indent=4)}'
            )
        except (ValueError, Exception) as e:
            MessageBox(f'{e}', 'Error', OK | ICON_ERROR)
        EndBusyCursor()
Beispiel #14
0
    def doAction(self, umlObjects: List[OglClass], selectedObjects: List[OglClass], umlFrame: UmlFrame):
        """
        Do the tool's action

        Args:
            umlObjects:         list of the uml objects of the diagram
            selectedObjects:    list of the selected objects
            umlFrame:           The diagram frame
        """
        if umlFrame is None:
            self.displayNoUmlFrame()
            return
        if len(umlObjects) == 0:
            self.displayNoUmlObjects()
            return

        try:
            orthogonalAdapter: OrthogonalAdapter = OrthogonalAdapter(umlObjects=selectedObjects)

            layoutAreaSize: LayoutAreaSize = LayoutAreaSize(self._layoutWidth, self._layoutHeight)
            orthogonalAdapter.doLayout(layoutAreaSize)
        except OrthogonalAdapterException as oae:
            MessageBox(f'{oae}', 'Error', OK | ICON_ERROR)
            return

        if orthogonalAdapter is not None:
            self._reLayoutNodes(selectedObjects, umlFrame, orthogonalAdapter.oglCoordinates)
            self._reLayoutLinks(selectedObjects, umlFrame)
Beispiel #15
0
	def rstor( self, event ):
		#print event.GetEventObject()
		self.unpack(self.ifil)
		self.recdb()
		MessageBox(u'بازيابي اطلاعات با موفقيت انجام شد',u'اعلان',OK | ICON_INFORMATION)
		p= wx.GetApp()
		p.Exit()
		wx.App_CleanUp()
Beispiel #16
0
 def chkghbz( self ):
         if self.fld1.GetValue() == '':
                 MessageBox(u'مبلغ قبض را مشخص کنيد',u'خطا',OK | ICON_WARNING)
                 return 0
         if self.idate.GetValue() == '':
                 MessageBox(u'تاريخ را مشخص کنيد',u'خطا',OK | ICON_WARNING)
                 return 0
         if self.fld3.GetValue() == '':
                 MessageBox(u'حساب را انتخاب کنيد',u'خطا',OK | ICON_WARNING)
                 return 0
         if self.fld4.GetValue() == '':
                 MessageBox(u'شرح را بنويسيد',u'خطا',OK | ICON_WARNING)
                 return 0
         if self.fld5.GetValue() == '':
                 MessageBox(u'شماره قبض را مشخص کنيد',u'خطا',OK | ICON_WARNING)
                 return 0
         return 1
Beispiel #17
0
    def chkacc(self):

        if self.iMolk.gAccod(self.fld0.GetValue()) == []:
            MessageBox(u'جهت ثبت مشتري جديد به ورود اطلاعات مشتري جديد برويد',
                       u'خطا', OK | ICON_WARNING)
            return 0

        return 1
Beispiel #18
0
 def savit(self, event):
     if self.chkacc() == 1:
         data = self.GetData()
         self.jMolk.InAcc("Acc , name , phone , Spc , Res ", data)
         MessageBox(u'مشتري جديد با موفقيت ثبت شد', u'اعلان',
                    OK | ICON_INFORMATION)
         q = self.GetParent()
         q.Close()
Beispiel #19
0
 def savit(self, event):
     if self.chkacc() == 1:
         data = self.GetData()
         self.jMolk.DelAcc("  Acc = '%s' " % self.accod)
         self.jMolk.DelSpec(" Spc = %s " % self.ispec)
         MessageBox(u'مشتري حذف شد', u'اعلان', OK | ICON_INFORMATION)
         q = self.GetParent()
         q.Close()
Beispiel #20
0
 def savit(self, event):
     if self.chkacc() == 1:
         data = self.GetData()
         self.jMolk.UpAcc(
             " name = ?  , phone = ?  where Acc = %s " % self.accod, data)
         MessageBox(u'اصلاح با موفقيت انجام شد', u'اعلان',
                    OK | ICON_INFORMATION)
         q = self.GetParent()
         q.Close()
Beispiel #21
0
    def __OnForward(self, event):
        """
        go one level forward; load next page

        @since 1.1
        @author C.Dutoit
        """
        if not self.html.HistoryForward():
            MessageBox(_("No more items in history !"))
Beispiel #22
0
    def __OnBack(self, event):
        """
        go one level back; load last page

        @since 1.1
        @author C.Dutoit
        """
        if not self.html.HistoryBack():
            MessageBox(_("No more items in history !"))
Beispiel #23
0
    def on_but_not_login(self, event):
        try:
            with open('config.yml', 'r', encoding='utf-8') as f:
                cont = f.read()
                config = yaml.load(cont, Loader=yaml.BaseLoader)
                with open('config.yml', 'w', encoding='utf-8') as f:
                    config['token'] = 'not login'
                    yaml.dump(config, f, default_flow_style=False, encoding='utf-8', allow_unicode=True)
            self.frame.Show(False)

            MessageBox(
                '使用方法:\n1.首先复制一张图片,本地的或者网\n'
                '页上的,或者使用截图工具截图;\n'
                '2.随后按' + hotkeys + '上传;\n'
                                    '3.成功后会返回url至你的剪贴板。\n\n提示:\n1.免登录使用将无法在线查看你的全部上\n传记录,仅可查看本IP的上传记录\n2.可编辑config.yml修改快捷键',
                "温馨提示")
        except KeyError:
            MessageBox('出现了未知问题,请提交issue', "警告")
Beispiel #24
0
 def connect(self):
     #print self.database
     try:
         self.connection = sqlite3.connect(self.database)
         self.cursor = self.connection.cursor()
     except:
         MessageBox(u'No Database find', u'Error', OK | ICON_WARNING)
     self.connected = True
     self.statement = ''
     return self.connection
Beispiel #25
0
    def ApplyHosts(self, hostsId: int):
        commonHostsLines = "# hosts file apply by mHosts v%s, %s\n " % (
            Settings.version(), Now())
        currentHostsLines = ""
        currentHosts = None

        for hosts in Settings.settings["hosts"]:
            if hosts["id"] == hostsId:
                currentHostsLines += "# ---------------- %(name)s ----------------%(br)s%(content)s%(br)s" % {
                    "name": hosts['name'],
                    "br": os.linesep,
                    "content": hosts['content']
                }
                currentHosts = hosts
            if hosts["alwaysApply"]:
                commonHostsLines += "# ---------------- %(name)s ----------------%(br)s%(content)s%(br)s" % {
                    "name": hosts['name'],
                    "br": os.linesep,
                    "content": hosts['content']
                }

        hostsToApply = commonHostsLines + os.linesep + currentHostsLines
        try:
            if Hosts.Save2System(ParseHosts(hostsToApply)):
                for hosts in Settings.settings["hosts"]:
                    hosts["active"] = hosts["id"] == hostsId
                refreshDnsRes = Hosts.TryFlushDNSCache()
                MessagePanel.Send("Hosts已设置为" + currentHosts["name"] +
                                  "\nDNS缓存刷新" +
                                  ("成功" if refreshDnsRes else "失败"),
                                  "保存成功",
                                  dpi=(self.dpiX, self.dpiY))
            else:
                MessageBox("保存失败", "提示", ICON_ERROR)
            self.InitHostsTree(ID_SYSTEM_HOSTS)
            Settings.Save()
        except Exception as e:
            message = str(e)
            if "Permission denied" in message:
                MessageBox("尝试写入hosts时权限不足, 保存失败, 请以管理员身份运行该软件", "权限不足",
                           ICON_ERROR)
            else:
                MessageBox(message, "保存时出错", ICON_ERROR)
Beispiel #26
0
def getregkey():
    access = win32con.KEY_READ | win32con.KEY_ENUMERATE_SUB_KEYS | win32con.KEY_QUERY_VALUE
    keypath = "SYSTEM\\CurrentControlSet\\Services\\disk\\Enum"

    try:
        hkey = win32api.RegOpenKey(win32con.HKEY_LOCAL_MACHINE, keypath, 0,
                                   access)
    except Exception, e:
        MessageBox(e, u'error', OK | ICON_WARNING)
        return ''
Beispiel #27
0
 def arcacc(self, code):
     self.ispec = self.iMolk.gAcsp(code)[0][0]
     #Sdata = self.iMolk.gASpc(self.ispec)
     if self.iMolk.gAAcod(code) == []:
         Data = self.iMolk.gAccod2(code)[0]
         self.jMolk.InAAcc("Acc , name, phone ,Spc ,Res ", Data)
         Sdata = self.iMolk.gASpc(self.ispec)
         self.jMolk.ASpecin2('Spc , tit, Spcfy ', Sdata)
         self.delacc(code)
     else:
         MessageBox(u'قبلا مشتري بايگاني شده', u'خطا', OK | ICON_WARNING)
Beispiel #28
0
    def OnAddEmail(self, email):
        blist = self.blist
        emails = blist.get_contact_info(self.info_key, 'email')
        emails = list(emails) if emails is not None else []

        if not is_email(email):
            MessageBox(_(
                'Please enter a valid email address (ie: [email protected])'),
                       _('Invalid Email Address'),
                       style=wx.ICON_ERROR)

        elif email in emails:
            MessageBox(_('That email is already registered with this buddy.'),
                       _('Add Email Address'))

        else:
            emails.append(email)
            blist.set_contact_info(self.info_key, 'email', emails)
            self.OnLoseFocus()
            return email
Beispiel #29
0
 def on_but_login(self, event):
     username = self.entry_user.GetValue()
     password = self.entry_pass.GetValue()
     try:
         token = Smms.get_token(username, password)
         with open('config.yml', 'r', encoding='utf-8') as f:
             cont = f.read()
             config = yaml.load(cont, Loader=yaml.BaseLoader)
             with open('config.yml', 'w', encoding='utf-8') as f:
                 config['token'] = token
                 yaml.dump(config, f, default_flow_style=False, encoding='utf-8', allow_unicode=True)
         self.frame.Show(False)
         MessageBox('登陆成功!\n'
                    '使用方法:\n1.首先复制一张图片,本地的或者网\n'
                    '页上的,或者使用截图工具截图;\n'
                    '2.随后按' + hotkeys + '上传;\n'
                                        '3.成功后会返回url至你的剪贴板。\n\n提示:\n可编辑config.yml修改快捷键',
                    "温馨提示")
     except KeyError:
         MessageBox('密码或账号错误', "警告")
Beispiel #30
0
            def on_error(errstr=None):
                if errstr is not None:
                    more = '\n' + _(
                        'The error message received was:') + '\n\t%s' % errstr
                else:
                    more = ''

                MessageBox(
                    _('There was an error in sending your SMS message.') +
                    more,
                    _('Send SMS Message Error'),
                    style=wx.ICON_ERROR)