Skip to content

Commit d03a852

Browse files
committed
0.29-dev
update ideplus ...
1 parent ca0e6f7 commit d03a852

File tree

2 files changed

+104
-11
lines changed

2 files changed

+104
-11
lines changed

binpythonfull.py

Lines changed: 104 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
####################################
1010
#build configure
1111

12-
ver="0.28-releases-full"
12+
ver="0.29-dev-full"
1313

1414
libs_warning="1"
1515
#1 is ture 0 is false.
@@ -68,6 +68,7 @@ def self_import(name):
6868
import sys
6969
import platform
7070
import os
71+
import timeit
7172
#fix for exit()
7273
from sys import exit
7374
#import for http_server
@@ -101,12 +102,12 @@ def importpygame():
101102
if libs_warning == "1":
102103
print("Warning: Some math or computation libraries for BINPython do not exist, such as fractions and cmath. Because they weren't built when they were built. If you need to fix this warning, please complete the support libraries imported in the source code when building (use pip or build it yourself), if your system does not support these libraries, you can remove or change this prompt in the source code and rebuild")
103104
print("")
104-
#rlcompleter
105105
#import for normal
106106
try:
107107
#str
108108
import rlcompleter
109109
import array
110+
import xlrd
110111
except ImportError:
111112
if libs_warning == "1":
112113
print("Warning: Some libraries for functions, data types, etc. for BINPython do not exist, such as rlcomplter and array. Because they weren't built when they were built. If you need to fix this warning, please complete the support libraries imported in the source code when building (use pip or build it yourself), if your system does not support these libraries, you can remove or change this prompt in the source code and rebuild")
@@ -267,7 +268,6 @@ def show():
267268
master.mainloop()
268269
sys.exit()
269270
if opt_name in ('-p','--plus'):
270-
serverport = input("Please enter server port(like 8080): ")
271271
import pywebio.input
272272
from pywebio.input import *
273273
from pywebio.output import *
@@ -276,19 +276,110 @@ def show():
276276
import sys
277277
import subprocess
278278
import os
279+
import webbrowser
279280
print("______________________________________")
280281
print("BINPython WEB IDE STARTED")
282+
print("""
283+
Welcome to BINPython IDEPlus!
284+
The service starts on port 22948 (http), the program will automatically open the browser, if not, please manually open http://localhost:22948 in the browser
285+
""")
286+
webbrowser.open("http://localhost:22940")
281287
#IDE Plus main
282-
def main():
288+
def line():
289+
put_text('_______________________',
290+
sep=' '
291+
)
292+
def head():
293+
set_env(title="BINPython IDE Plus", auto_scroll_bottom=True)
294+
put_html("""
295+
<nav class="navbar navbar-expand-lg navbar-light bg-light">
296+
<a class="navbar-brand" href="http://localhost:22940"></a>
297+
<img src="https://github.com/xingyujie/binpython/blob/main/py.ico?raw=true" width="30" height="30" class="d-inline-block align-top" alt="">
298+
BINPython IDEPlus
299+
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
300+
<span class="navbar-toggler-icon"></span>
301+
</button>
302+
<div class="collapse navbar-collapse" id="navbarSupportedContent">
303+
<ul class="navbar-nav mr-auto">
304+
<li class="nav-item">
305+
<a class="nav-link active" aria-current="page" href="http://localhost:22940/">Home</a>
306+
</li>
307+
<li class="nav-item">
308+
<a class="nav-link" href="http://localhost:22940/?app=ideplus">IDEPlus</a>
309+
</li>
310+
</a>
311+
</ul>
312+
</div>
313+
</nav>
314+
315+
""")
316+
def plushead():
317+
set_env(title="BINPython IDE Plus", auto_scroll_bottom=True)
318+
put_html("""
319+
<nav class="navbar navbar-expand-lg navbar-light bg-light">
320+
<a class="navbar-brand" href="http://localhost:22940"></a>
321+
<img src="https://github.com/xingyujie/binpython/blob/main/py.ico?raw=true" width="30" height="30" class="d-inline-block align-top" alt="">
322+
BINPython IDEPlus
323+
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
324+
<span class="navbar-toggler-icon"></span>
325+
</button>
326+
<div class="collapse navbar-collapse" id="navbarSupportedContent">
327+
<ul class="navbar-nav mr-auto">
328+
<li class="nav-item">
329+
<a class="nav-link" href="http://localhost:22940/">Home</a>
330+
</li>
331+
<li class="nav-item">
332+
<a class="nav-link active" aria-current="page" href="http://localhost:22940/?app=ideplus">IDEPlus</a>
333+
</li>
334+
</a>
335+
</ul>
336+
</div>
337+
</nav>
338+
339+
""")
340+
def aboutideplus():
341+
head()
342+
put_markdown("## About BINPython IDEPlus")
343+
put_markdown("""
344+
BINPython is made by:
345+
346+
[xingyujie(Edward Hsing)](https://github.com/xingyujie)
347+
348+
AGPL-V3.0 Release
349+
350+
""")
351+
def welcomecard():
352+
put_html("""
353+
<div class="jumbotron">
354+
<h1 class="display-3">Welcome to BINPython!</h1>
355+
<p class="lead">This is a portable IDE environment for BINPython</p>
356+
<hr class="my-4">
357+
<p>Fast and portable, runs via BINPython</p>
358+
<p class="lead">
359+
<a class="btn btn-primary btn-lg" href="http://localhost:22940/?app=ideplus" role="button">Try IDE Plus!</a>
360+
</p>
361+
</div>
362+
""")
363+
def index():
364+
head()
365+
welcomecard()
366+
put_markdown("## Features")
367+
put_link("IDEPlus", url='http://localhost:22940/?app=ideplus')
368+
line()
369+
put_link("About BINPython", url='http://localhost:22940/?app=aboutideplus')
370+
line()
371+
put_link("View Code", url='http://localhost:22940/?app=viewcode')
372+
def idehead():
283373
set_env(title="BINPython IDE Plus", auto_scroll_bottom=True)
284374
put_html("<h1>BINPython IDE Plus</h1>")
285375
put_text('Welcome to BINPython IDE Plus, Please type code',
286376
sep=' '
287377
)
378+
line()
288379
toast("BINPython IDE Plus is a beta version. May be removed or changed in the future")
289-
put_text('_______________________',
290-
sep=' '
291-
)
380+
def ideplus():
381+
plushead()
382+
idehead()
292383
res = textarea('BINPython IDE Plus', rows=45, code={
293384
'mode': "python",
294385
'theme': 'darcula'
@@ -303,8 +394,13 @@ def main():
303394
f.write(res.encode("utf-8"))
304395
toast("Successfully saved")
305396
put_success("The save is successful, and the code is saved to binpython file path" + " \nThe file name is " + '"' + savecodefilename + '"')
397+
def viewcode():
398+
plushead()
399+
viewcode_code = pywebio.input.input("Please input file path:")
400+
f = open(viewcode_code,encoding = "utf-8")
401+
put_code(f.read(), language='python')
306402
if __name__ == '__main__':
307-
start_server(main, debug=True, port= serverport)
403+
start_server([index, ideplus, aboutideplus, viewcode], debug=True, port= 22940)
308404
pywebio.session.hold()
309405
if opt_name in ('-e','--example'):
310406
print("Welcome to BINPython example")
@@ -416,8 +512,6 @@ def examplerequests():
416512
f = open("binpython_debug",encoding = "utf-8")
417513
print("Debug mode:on")
418514
print("BINPython debug INFO")
419-
#coding=utf-8
420-
421515
def TestPlatform():
422516
import platform
423517
print(platform.python_version())

packagelist.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
pygame
22
pyinstaller
3-
turtle
43
pywebio
54
torondo

0 commit comments

Comments
 (0)