Skip to content

Commit

Permalink
兼容长key字典的处理模式
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuyude committed Jun 18, 2021
1 parent a716bfb commit 7b35de5
Show file tree
Hide file tree
Showing 10 changed files with 292 additions and 269 deletions.
31 changes: 27 additions & 4 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@

from mylistplace import QmyListPlace

def split_dic(re_list):
#返回排好序的长key字典的同时改变原来的字典(去掉那些长key的项)
long_key = {}
#把key大于1字符的项分到long_key
for key, _ in re_list.items():
if len(key) > 1:
long_key[key] = re_list[key]

#删除re_list中的
for key, _ in long_key.items():
del re_list[key]
#返回排好序的长keydict
return dict(sorted(long_key.items(), key=lambda d: len(d[0]), reverse=True))

class MyWidget(QSystemTrayIcon):
#注册表中un_valid为0则停用全局禁止,为1则启用
Expand Down Expand Up @@ -155,13 +168,23 @@ def fun(self):
if "," in self.re_list:
processed = re.sub(", +",",",processed)

#处理整个对话框列表的问题
#先处理对话框列表中的长key字典
order_longkeydic = split_dic(self.re_list)
for key, value in order_longkeydic.items():
if key in processed:
result_text = processed.replace(key,value)
comparison[key] = value
else:
result_text = processed

#处理整个对话框列表的单字符key字典
for x in list(processed):
if x in self.re_list:
result_text+=self.re_list[x]
comparison[x]=self.re_list[x]
result_text += self.re_list[x]
comparison[x] = self.re_list[x]
else:
result_text+=x
result_text += x

self.last_text = result_text

if text != result_text:#字符有替换或编码有调整
Expand Down
174 changes: 87 additions & 87 deletions venv/Scripts/build/run/Analysis-00.toc

Large diffs are not rendered by default.

166 changes: 83 additions & 83 deletions venv/Scripts/build/run/EXE-00.toc

Large diffs are not rendered by default.

Binary file modified venv/Scripts/build/run/PKG-00.pkg
Binary file not shown.
164 changes: 82 additions & 82 deletions venv/Scripts/build/run/PKG-00.toc

Large diffs are not rendered by default.

Binary file modified venv/Scripts/build/run/PYZ-00.pyz
Binary file not shown.
10 changes: 5 additions & 5 deletions venv/Scripts/build/run/PYZ-00.toc
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
('stat',
'c:\\users\\lenovo\\appdata\\local\\programs\\python\\python37\\lib\\stat.py',
'PYMODULE'),
('_py_abc',
'c:\\users\\lenovo\\appdata\\local\\programs\\python\\python37\\lib\\_py_abc.py',
'PYMODULE'),
('copy',
'c:\\users\\lenovo\\appdata\\local\\programs\\python\\python37\\lib\\copy.py',
'PYMODULE'),
('typing',
'c:\\users\\lenovo\\appdata\\local\\programs\\python\\python37\\lib\\typing.py',
'PYMODULE'),
('tracemalloc',
'c:\\users\\lenovo\\appdata\\local\\programs\\python\\python37\\lib\\tracemalloc.py',
'PYMODULE'),
Expand Down Expand Up @@ -395,8 +395,8 @@
('fnmatch',
'c:\\users\\lenovo\\appdata\\local\\programs\\python\\python37\\lib\\fnmatch.py',
'PYMODULE'),
('typing',
'c:\\users\\lenovo\\appdata\\local\\programs\\python\\python37\\lib\\typing.py',
('_py_abc',
'c:\\users\\lenovo\\appdata\\local\\programs\\python\\python37\\lib\\_py_abc.py',
'PYMODULE'),
('stringprep',
'c:\\users\\lenovo\\appdata\\local\\programs\\python\\python37\\lib\\stringprep.py',
Expand Down
Binary file modified venv/Scripts/build/run/base_library.zip
Binary file not shown.
4 changes: 2 additions & 2 deletions venv/Scripts/build/run/warn-run.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ missing module named _posixsubprocess - imported by subprocess (conditional)
missing module named pwd - imported by posixpath (delayed, conditional), shutil (optional), tarfile (optional), http.server (delayed, optional), webbrowser (delayed), netrc (delayed, conditional), getpass (delayed)
missing module named posix - imported by os (conditional, optional)
missing module named resource - imported by posix (top-level)
missing module named org - imported by copy (optional)
missing module named 'org.python' - imported by copy (optional), xml.sax (delayed, conditional)
missing module named grp - imported by shutil (optional), tarfile (optional)
missing module named termios - imported by tty (top-level), getpass (optional)
missing module named vms_lib - imported by platform (delayed, conditional, optional)
Expand All @@ -29,7 +29,7 @@ missing module named _winreg - imported by platform (delayed, optional)
missing module named _frozen_importlib_external - imported by importlib._bootstrap (delayed), importlib (optional), importlib.abc (optional)
excluded module named _frozen_importlib - imported by importlib (optional), importlib.abc (optional)
missing module named readline - imported by cmd (delayed, conditional, optional), code (delayed, conditional, optional), pdb (delayed, optional)
missing module named 'org.python' - imported by pickle (optional), xml.sax (delayed, conditional)
missing module named org - imported by pickle (optional)
missing module named AppKit - imported by pyperclip (delayed, conditional, optional)
missing module named Foundation - imported by pyperclip (delayed, conditional, optional)
missing module named PyQt4 - imported by pyperclip (delayed, conditional, optional)
Expand Down
12 changes: 6 additions & 6 deletions venv/Scripts/build/run/xref-run.html
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ <h1>modulegraph cross reference for pyi_rth_pyqt5.py, run.py</h1>
<a target="code" href="" type="text/plain"><tt>'org.python'</tt></a>
<span class="moduletype">MissingModule</span> <div class="import">
imported by:
<a href="#pickle">pickle</a>
<a href="#copy">copy</a>
&#8226; <a href="#xml.sax">xml.sax</a>

</div>
Expand Down Expand Up @@ -1760,8 +1760,8 @@ <h1>modulegraph cross reference for pyi_rth_pyqt5.py, run.py</h1>
<a target="code" href="///C:/users/lenovo/appdata/local/programs/python/python37/lib/copy.py" type="text/plain"><tt>copy</tt></a>
<span class="moduletype">SourceModule</span> <div class="import">
imports:
<a href="#copyreg">copyreg</a>
&#8226; <a href="#org">org</a>
<a href="#'org.python'">'org.python'</a>
&#8226; <a href="#copyreg">copyreg</a>
&#8226; <a href="#types">types</a>
&#8226; <a href="#weakref">weakref</a>

Expand Down Expand Up @@ -6279,7 +6279,7 @@ <h1>modulegraph cross reference for pyi_rth_pyqt5.py, run.py</h1>
<a target="code" href="" type="text/plain"><tt>org</tt></a>
<span class="moduletype">MissingModule</span> <div class="import">
imported by:
<a href="#copy">copy</a>
<a href="#pickle">pickle</a>

</div>

Expand Down Expand Up @@ -6404,8 +6404,7 @@ <h1>modulegraph cross reference for pyi_rth_pyqt5.py, run.py</h1>
<a target="code" href="///C:/users/lenovo/appdata/local/programs/python/python37/lib/pickle.py" type="text/plain"><tt>pickle</tt></a>
<span class="moduletype">SourceModule</span> <div class="import">
imports:
<a href="#'org.python'">'org.python'</a>
&#8226; <a href="#_compat_pickle">_compat_pickle</a>
<a href="#_compat_pickle">_compat_pickle</a>
&#8226; <a href="#_pickle">_pickle</a>
&#8226; <a href="#argparse">argparse</a>
&#8226; <a href="#codecs">codecs</a>
Expand All @@ -6414,6 +6413,7 @@ <h1>modulegraph cross reference for pyi_rth_pyqt5.py, run.py</h1>
&#8226; <a href="#functools">functools</a>
&#8226; <a href="#io">io</a>
&#8226; <a href="#itertools">itertools</a>
&#8226; <a href="#org">org</a>
&#8226; <a href="#pprint">pprint</a>
&#8226; <a href="#re">re</a>
&#8226; <a href="#struct">struct</a>
Expand Down

0 comments on commit 7b35de5

Please sign in to comment.