diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..bb831c4
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..aeb7613
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/untitled.iml b/.idea/untitled.iml
new file mode 100644
index 0000000..85c7612
--- /dev/null
+++ b/.idea/untitled.iml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..96dcde9
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,297 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ pyfile
+ file
+ new.png
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1558277602126
+
+
+ 1558277602126
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index 1c60065..a7f6c93 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,20 @@ Simple! Easy! Quick! Start your micropython code!
# uasge
+1. download editor.exe
+
+double click it.
+
+2. pip insrall mpy-editor
+
+run `pip insrall mpy-editor` in your cmd(shell), then input `editor` run it.
+
+```shell
+pip insrall mpy-editor
+
+editor
+```
+
## Open mpy-editor.
## Connect your hardware.
@@ -22,8 +36,20 @@ pyinstaller -w -F editor.py -i logo.ico
2. modify editor.spec
-in 9 line editor.spec add `datas=[('img', 'img')],`
+in 9 line editor.spec add `datas=[('mpy\\img','img')],`
3. create editor.exe
pyinstaller -w -F editor.spec -i logo.ico
+
+# uplaod pypi
+
+```shell
+python setup.py sdist build
+```
+
+```shell
+# pip install twine
+twine upload dist/*
+```
+
diff --git a/editor b/editor
new file mode 100644
index 0000000..a5638f5
--- /dev/null
+++ b/editor
@@ -0,0 +1,11 @@
+#!/usr/bin/env python
+
+import sys
+
+from mpy.editor import run
+
+try:
+ run()
+except Exception as e:
+ sys.stderr.write(str(e) + "\n")
+ exit(1)
diff --git a/mpy/__init__.py b/mpy/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/editor.py b/mpy/editor.py
similarity index 99%
rename from editor.py
rename to mpy/editor.py
index 7bdf3f2..a320de2 100644
--- a/editor.py
+++ b/mpy/editor.py
@@ -26,8 +26,9 @@
def resource_path(relative):
if hasattr(sys, "_MEIPASS"):
return os.path.join(sys._MEIPASS, relative)
- return os.path.join(relative)
-
+ # print(os.path.dirname(os.path.realpath(__file__)))
+ else:
+ return os.path.join(os.path.dirname(os.path.realpath(__file__)), relative)
def center_window(window):
window.update_idletasks()
@@ -155,7 +156,7 @@ def save_file(self):
self.text_area.get(1.0, tk.END)[:-1]) # Text.get adds \n to the end, so this must be cut with [:-1]
self.master.tab(self.master.select(), text=self.title)
else:
- self.file = filedialog.asksaveasfilename(initialdir="", title="Save File", defaultextension = '.py',
+ self.file = filedialog.asksaveasfilename(initialdir="", title="Save File", defaultextension='.py',
filetypes=[("python files", "*.py"), ("all files", "*.*")])
with open(self.file, "w") as f:
f.write(self.text_area.get(1.0, tk.END))
@@ -334,7 +335,6 @@ def new_tab(self, title="untitled", file=None):
if len(self.notebook_tabs) < 10:
self._add_tab(title, file)
-
def toggle_repl(self, visibility=None):
if not self.repl:
return
diff --git a/img/close.gif b/mpy/img/close.gif
similarity index 100%
rename from img/close.gif
rename to mpy/img/close.gif
diff --git a/img/close_active.gif b/mpy/img/close_active.gif
similarity index 100%
rename from img/close_active.gif
rename to mpy/img/close_active.gif
diff --git a/img/close_pressed.gif b/mpy/img/close_pressed.gif
similarity index 100%
rename from img/close_pressed.gif
rename to mpy/img/close_pressed.gif
diff --git a/img/device.png b/mpy/img/device.png
similarity index 100%
rename from img/device.png
rename to mpy/img/device.png
diff --git a/img/device_alert.png b/mpy/img/device_alert.png
similarity index 100%
rename from img/device_alert.png
rename to mpy/img/device_alert.png
diff --git a/img/files.png b/mpy/img/files.png
similarity index 100%
rename from img/files.png
rename to mpy/img/files.png
diff --git a/img/load_file.png b/mpy/img/load_file.png
similarity index 100%
rename from img/load_file.png
rename to mpy/img/load_file.png
diff --git a/img/new.png b/mpy/img/new.png
similarity index 100%
rename from img/new.png
rename to mpy/img/new.png
diff --git a/img/repl.png b/mpy/img/repl.png
similarity index 100%
rename from img/repl.png
rename to mpy/img/repl.png
diff --git a/img/run.png b/mpy/img/run.png
similarity index 100%
rename from img/run.png
rename to mpy/img/run.png
diff --git a/img/run0.png b/mpy/img/run0.png
similarity index 100%
rename from img/run0.png
rename to mpy/img/run0.png
diff --git a/img/save.png b/mpy/img/save.png
similarity index 100%
rename from img/save.png
rename to mpy/img/save.png
diff --git a/img/theme.png b/mpy/img/theme.png
similarity index 100%
rename from img/theme.png
rename to mpy/img/theme.png
diff --git a/img/theme_day.png b/mpy/img/theme_day.png
similarity index 100%
rename from img/theme_day.png
rename to mpy/img/theme_day.png
diff --git a/img/zoom-in.png b/mpy/img/zoom-in.png
similarity index 100%
rename from img/zoom-in.png
rename to mpy/img/zoom-in.png
diff --git a/img/zoom-out.png b/mpy/img/zoom-out.png
similarity index 100%
rename from img/zoom-out.png
rename to mpy/img/zoom-out.png
diff --git a/setup.py b/setup.py
index 15d817d..e13c241 100644
--- a/setup.py
+++ b/setup.py
@@ -3,15 +3,17 @@
from distutils.core import setup
setup(name='mpy-editor',
- version="%d.%d.%d" % (1, 0, 0),
+ version="%d.%d.%d" % (1, 0, 7),
description='Simple! Easy! Quick! Start your micropython code!',
author='Juwan',
author_email='junhuanchen@qq.com',
url='https://github.com/junhuanchen/mpy-editor',
download_url='https://codeload.github.com/junhuanchen/mpy-editor/zip/master',
install_requires=['pyserial', 'Pillow', 'Pygments'],
- scripts=['editor.py'],
+ packages=['mpy'],
+ package_data={'mpy': ['img//*.gif','img//*.png']},
+ scripts=['editor'],
keywords=['micropython', 'editor', 'simple', 'easy', 'quick'],
classifiers=[],
- entry_points={"console_scripts": ["editor=editor.py"]},
+ entry_points={"console_scripts": ["editor=mpy.editor:run"]},
)