Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
poezio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
203
Issues
203
List
Boards
Labels
Service Desk
Milestones
Merge Requests
9
Merge Requests
9
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
poezio
poezio
Commits
94153c49
Commit
94153c49
authored
Aug 04, 2010
by
louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes the sys.excepthook thread bug, and fix the traceback on joining a room with non-ascii chars
parent
567491ba
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
6 deletions
+35
-6
src/common.py
src/common.py
+1
-0
src/gui.py
src/gui.py
+3
-1
src/poezio.py
src/poezio.py
+27
-5
src/user.py
src/user.py
+4
-0
No files found.
src/common.py
View file @
94153c49
...
...
@@ -45,6 +45,7 @@ import sys
import
select
import
errno
import
time
import
traceback
import
xmpp
...
...
src/gui.py
View file @
94153c49
...
...
@@ -141,6 +141,7 @@ class Gui(object):
"""
main loop waiting for the user to press a key
"""
self
.
refresh_window
()
while
True
:
doupdate
()
char
=
read_char
(
stdscr
)
...
...
@@ -163,7 +164,7 @@ class Gui(object):
returns the room that has this name
"""
for
room
in
self
.
rooms
:
if
room
.
name
==
name
:
if
room
.
name
.
decode
(
'utf-8'
)
==
name
:
return
room
return
None
...
...
@@ -449,6 +450,7 @@ class Gui(object):
from_room
=
stanza
.
getFrom
().
getStripped
()
room
=
self
.
get_room_by_name
(
from_room
)
if
not
room
:
# common.debug(':(:(:(:(\n')
return
else
:
msg
=
None
...
...
src/poezio.py
View file @
94153c49
...
...
@@ -21,9 +21,28 @@
Starting point of poezio. Launches both the Connection and Gui
"""
import
threading
import
sys
import
traceback
import
curses
def
installThreadExcepthook
():
"""
Workaround for sys.excepthook thread bug
See http://bugs.python.org/issue1230540
Python, you made me sad :(
"""
init_old
=
threading
.
Thread
.
__init__
def
init
(
self
,
*
args
,
**
kwargs
):
init_old
(
self
,
*
args
,
**
kwargs
)
run_old
=
self
.
run
def
run_with_except_hook
(
*
args
,
**
kw
):
try
:
run_old
(
*
args
,
**
kw
)
except
(
KeyboardInterrupt
,
SystemExit
):
raise
except
:
sys
.
excepthook
(
*
sys
.
exc_info
())
self
.
run
=
run_with_except_hook
threading
.
Thread
.
__init__
=
init
class
MyStdErr
(
object
):
def
__init__
(
self
,
fd
):
...
...
@@ -52,11 +71,14 @@ def exception_handler(type_, value, trace):
curses
.
endwin
()
curses
.
echo
()
traceback
.
print_exception
(
type_
,
value
,
trace
,
None
,
sys
.
stderr
)
sys
.
exit
(
2
)
import
os
# used to quit the program even from a thread
os
.
abort
()
sys
.
excepthook
=
exception_handler
import
common
import
sys
import
curses
import
signal
from
connection
import
Connection
from
multiuserchat
import
MultiUserChat
...
...
@@ -64,7 +86,6 @@ from config import config
from
gui
import
Gui
from
curses
import
initscr
import
signal
signal
.
signal
(
signal
.
SIGINT
,
signal
.
SIG_IGN
)
# ignore ctrl-c
def
main
():
...
...
@@ -80,4 +101,5 @@ def main():
gui
.
main_loop
(
stdscr
)
if
__name__
==
'__main__'
:
installThreadExcepthook
()
main
()
src/user.py
View file @
94153c49
...
...
@@ -19,6 +19,7 @@
from
random
import
randrange
from
config
import
config
from
datetime
import
timedelta
,
datetime
import
curses
class
User
(
object
):
"""
...
...
@@ -29,6 +30,9 @@ class User(object):
self
.
update
(
affiliation
,
show
,
status
,
role
)
self
.
change_nick
(
nick
)
self
.
color
=
randrange
(
2
,
10
)
# assign a random color
# if randrange(1) == 0:
# self.color = 16
# self.color |= curses.A_BOLD
def
update
(
self
,
affiliation
,
show
,
status
,
role
):
self
.
affiliation
=
affiliation
...
...
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