Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uva
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Taddeüs Kroes
uva
Commits
96d89030
Commit
96d89030
authored
14 years ago
by
Sander Mathijs van Veen
Browse files
Options
Downloads
Patches
Plain Diff
Added proper connection error handling.
parent
692d3737
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
telematica/ass1/async.py
+6
-0
6 additions, 0 deletions
telematica/ass1/async.py
telematica/ass1/base_bar.py
+3
-3
3 additions, 3 deletions
telematica/ass1/base_bar.py
telematica/ass1/cli.py
+2
-0
2 additions, 0 deletions
telematica/ass1/cli.py
with
11 additions
and
3 deletions
telematica/ass1/async.py
+
6
−
0
View file @
96d89030
...
...
@@ -51,6 +51,12 @@ class ClientConnection(object, AsyncBase, asyncore.dispatcher):
if
'
connect
'
in
self
.
event_list
:
self
.
event_list
[
'
connect
'
](
self
)
def
handle_error
(
self
):
if
hasattr
(
self
,
'
main
'
):
self
.
main
.
execute
(
'
disconnect
'
)
self
.
main
.
display_info
(
'
Error raised due to a broken or refused
'
\
+
'
connection
'
)
def
handle_close
(
self
):
self
.
close
()
...
...
This diff is collapsed.
Click to expand it.
telematica/ass1/base_bar.py
+
3
−
3
View file @
96d89030
...
...
@@ -16,15 +16,15 @@ class BaseBar(object):
self
.
color_pair
=
curses
.
color_pair
(
0
)
self
.
_prefix
=
''
def
prefix
(
self
,
value
=
''
):
if
not
value
:
def
prefix
(
self
,
value
=
None
):
if
value
==
None
:
# Note: an empty string can also be set.
return
self
.
_prefix
self
.
_prefix
=
value
self
.
display
(
self
.
_msg
)
def
display
(
self
,
msg
):
self
.
_msg
=
msg
if
self
.
prefix
:
if
self
.
prefix
()
:
msg
=
self
.
prefix
()
+
'
'
+
msg
# Curses will raise a 'curses.error' when the last possible character is
# written. This exception should therefore always be catched. The raised
...
...
This diff is collapsed.
Click to expand it.
telematica/ass1/cli.py
+
2
−
0
View file @
96d89030
...
...
@@ -158,7 +158,9 @@ class CLI:
self
.
connection
=
None
self
.
display_info
(
'
Offline. Type
"
/connect HOST
"
to connect
'
\
+
'
to another chat server.
'
)
self
.
info_bar
.
prefix
(
''
)
self
.
debug_window
.
clear
()
self
.
refresh
()
def
help
(
main
):
if
main
.
chat_window
.
displayed_help
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment