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
204
Issues
204
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
6b4b32ff
Commit
6b4b32ff
authored
Aug 09, 2010
by
louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Print a line separator to indicate the new messages. fixed #1487
parent
835527e2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
4 deletions
+33
-4
src/gui.py
src/gui.py
+5
-4
src/room.py
src/room.py
+14
-0
src/window.py
src/window.py
+14
-0
No files found.
src/gui.py
View file @
6b4b32ff
...
...
@@ -181,8 +181,6 @@ class Gui(object):
returns the room that has this name
"""
for
room
in
self
.
rooms
:
from
common
import
debug
debug
(
'-- %s ? %s
\n
'
%
(
room
.
name
,
name
,))
if
room
.
name
.
decode
(
'utf-8'
)
==
name
:
return
room
return
None
...
...
@@ -318,6 +316,7 @@ class Gui(object):
rotate the rooms list to the right
"""
self
.
current_room
().
set_color_state
(
common
.
ROOM_STATE_NONE
)
self
.
current_room
().
remove_line_separator
()
self
.
rooms
.
append
(
self
.
rooms
.
pop
(
0
))
self
.
current_room
().
set_color_state
(
common
.
ROOM_STATE_CURRENT
)
self
.
refresh_window
()
...
...
@@ -327,6 +326,7 @@ class Gui(object):
rotate the rooms list to the right
"""
self
.
current_room
().
set_color_state
(
common
.
ROOM_STATE_NONE
)
self
.
current_room
().
remove_line_separator
()
self
.
rooms
.
insert
(
0
,
self
.
rooms
.
pop
())
self
.
current_room
().
set_color_state
(
common
.
ROOM_STATE_CURRENT
)
self
.
refresh_window
()
...
...
@@ -438,8 +438,6 @@ class Gui(object):
if
(
self
.
ignores
.
has_key
(
room_from
))
and
(
nick_from
in
self
.
ignores
[
room_from
]):
return
room
=
self
.
get_room_by_name
(
room_from
)
from
common
import
debug
debug
(
'%s
\n
'
%
room_from
)
if
not
room
:
self
.
information
(
_
(
"message received for a non-existing room: %s"
)
%
(
room_from
))
return
...
...
@@ -594,6 +592,8 @@ class Gui(object):
Add the message to the room and refresh the associated component
of the interface
"""
if
room
!=
self
.
current_room
():
room
.
add_line_separator
()
room
.
add_message
(
txt
,
time
,
nickname
)
if
room
==
self
.
current_room
():
self
.
window
.
text_win
.
refresh
(
room
)
...
...
@@ -678,6 +678,7 @@ class Gui(object):
if
self
.
current_room
().
nb
==
nb
:
return
self
.
current_room
().
set_color_state
(
common
.
ROOM_STATE_NONE
)
self
.
current_room
().
remove_line_separator
()
start
=
self
.
current_room
()
self
.
rooms
.
append
(
self
.
rooms
.
pop
(
0
))
while
self
.
current_room
().
nb
!=
nb
:
...
...
src/room.py
View file @
6b4b32ff
...
...
@@ -117,6 +117,20 @@ class Room(object):
time
=
time
if
time
is
not
None
else
datetime
.
now
()
self
.
messages
.
append
(
Message
(
txt
,
time
,
nickname
,
user
,
color
))
def
remove_line_separator
(
self
):
"""
Remove the line separator
"""
if
None
in
self
.
messages
:
self
.
messages
.
remove
(
None
)
def
add_line_separator
(
self
):
"""
add a line separator at the end of messages list
"""
if
None
not
in
self
.
messages
:
self
.
messages
.
append
(
None
)
def
get_user_by_name
(
self
,
nick
):
for
user
in
self
.
users
:
if
user
.
nick
==
nick
.
encode
(
'utf-8'
):
...
...
src/window.py
View file @
6b4b32ff
...
...
@@ -218,6 +218,9 @@ class TextWin(Win):
"""
lines
=
[]
for
message
in
messages
:
if
message
==
None
:
# line separator
lines
.
append
(
None
)
continue
txt
=
message
.
txt
if
not
txt
:
continue
...
...
@@ -285,6 +288,10 @@ class TextWin(Win):
y
=
0
for
line
in
lines
:
self
.
win
.
move
(
y
,
0
)
if
line
==
None
:
self
.
write_line_separator
()
y
+=
1
continue
if
line
.
time
is
not
None
:
self
.
write_time
(
line
.
time
)
if
line
.
nickname
is
not
None
:
...
...
@@ -293,6 +300,13 @@ class TextWin(Win):
y
+=
1
self
.
win
.
refresh
()
def
write_line_separator
(
self
):
"""
"""
self
.
win
.
attron
(
curses
.
color_pair
(
7
))
self
.
win
.
addstr
(
' -'
*
(
self
.
width
/
2
))
self
.
win
.
attroff
(
curses
.
color_pair
(
7
))
def
write_text
(
self
,
y
,
x
,
txt
,
color
):
"""
write the text of a line.
...
...
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