Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pdbfixer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pdbfixer
Commits
bce5e5f4
Commit
bce5e5f4
authored
Mar 23, 2014
by
Robert McGibbon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make it possible to kill with control c
parent
49d89de2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletions
+14
-1
pdbfixer/ui.py
+11
-0
pdbfixer/uiserver.py
+3
-1
No files found.
pdbfixer/ui.py
View file @
bce5e5f4
...
@@ -6,6 +6,7 @@ import uiserver
...
@@ -6,6 +6,7 @@ import uiserver
import
webbrowser
import
webbrowser
import
os.path
import
os.path
import
gzip
import
gzip
import
time
from
io
import
BytesIO
from
io
import
BytesIO
try
:
try
:
from
urllib.request
import
urlopen
from
urllib.request
import
urlopen
...
@@ -207,3 +208,12 @@ def launchUI():
...
@@ -207,3 +208,12 @@ def launchUI():
url
=
'http://localhost:'
+
str
(
uiserver
.
server
.
server_address
[
1
])
url
=
'http://localhost:'
+
str
(
uiserver
.
server
.
server_address
[
1
])
print
(
"PDBFixer running:
%
s "
%
url
)
print
(
"PDBFixer running:
%
s "
%
url
)
webbrowser
.
open
(
url
)
webbrowser
.
open
(
url
)
# the uiserver is running in a background daemon thread that dies whenever
# the main thread exits. So, to keep the whole process alive, we just sleep
# here in the main thread. When Control-C is called, the main thread shuts
# down and then the uiserver exits. Without this daemon/sleep combo, the
# process cannot be killed with Control-C. Reference stack overflow link:
# http://stackoverflow.com/a/11816038/1079728
while
True
:
time
.
sleep
(
0.5
)
\ No newline at end of file
pdbfixer/uiserver.py
View file @
bce5e5f4
...
@@ -69,7 +69,9 @@ callback = {}
...
@@ -69,7 +69,9 @@ callback = {}
server
=
_ThreadingHTTPServer
((
"localhost"
,
8000
),
_Handler
)
server
=
_ThreadingHTTPServer
((
"localhost"
,
8000
),
_Handler
)
def
beginServing
():
def
beginServing
():
Thread
(
target
=
server
.
serve_forever
)
.
start
()
t
=
Thread
(
target
=
server
.
serve_forever
)
t
.
daemon
=
True
t
.
start
()
def
setContent
(
newContent
):
def
setContent
(
newContent
):
global
content
global
content
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment