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
0dfd8366
Commit
0dfd8366
authored
Oct 05, 2010
by
louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use a timer to refresh only after a short delay. Limit the useless software refresh.
parent
53a5536c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
4 deletions
+27
-4
src/gui.py
src/gui.py
+27
-4
No files found.
src/gui.py
View file @
0dfd8366
...
...
@@ -25,6 +25,7 @@ import re
import
sys
import
shlex
import
curses
import
threading
import
webbrowser
from
datetime
import
datetime
...
...
@@ -65,6 +66,9 @@ SHOW_NAME = {
'chat'
:
_
(
'chatty'
),
''
:
_
(
'available'
)
}
resize_lock
=
threading
.
Lock
()
def
doupdate
():
curses
.
doupdate
()
...
...
@@ -86,6 +90,7 @@ class Gui(object):
self
.
information_buffer
=
TextBuffer
()
self
.
information_win_size
=
2
# Todo, get this from config
self
.
ignores
=
{}
self
.
resize_timer
=
None
self
.
commands
=
{
'help'
:
(
self
.
command_help
,
'\_o< KOIN KOIN KOIN'
),
...
...
@@ -129,7 +134,7 @@ class Gui(object):
"KEY_F(7)"
:
self
.
shrink_information_win
,
"KEY_F(8)"
:
self
.
grow_information_win
,
"^N"
:
self
.
rotate_rooms_right
,
"KEY_RESIZE"
:
self
.
resize_window
,
"KEY_RESIZE"
:
self
.
call_for_resize
,
'^X'
:
self
.
go_to_important_room
,
'^V'
:
self
.
move_separator
,
}
...
...
@@ -486,13 +491,31 @@ class Gui(object):
# TODO refresh roster_win only
self
.
refresh_window
()
def
call_for_resize
(
self
):
"""
Starts a very short timer. If no other terminal resize
occured in this delay then poezio is REALLY resize.
This is to avoid multiple unnecessary software resizes (this
can be heavy on resource on slow computers or networks)
"""
with
resize_lock
:
if
self
.
resize_timer
:
# a recent terminal resize occured.
# Cancel the programmed software resize
self
.
resize_timer
.
cancel
()
# add the new timer
self
.
resize_timer
=
threading
.
Timer
(
0.15
,
self
.
resize_window
)
self
.
resize_timer
.
start
()
def
resize_window
(
self
):
"""
Resize the whole screen
"""
for
tab
in
self
.
tabs
:
tab
.
resize
(
self
.
stdscr
)
self
.
refresh_window
()
with
resize_lock
:
self
.
resize_timer
=
None
for
tab
in
self
.
tabs
:
tab
.
resize
(
self
.
stdscr
)
self
.
refresh_window
()
def
main_loop
(
self
):
"""
...
...
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