Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
TSRh
gajim
Commits
5ed2e230
Commit
5ed2e230
authored
19 years ago
by
dkirov
Browse files
Options
Downloads
Patches
Plain Diff
added comments on some methods
parent
98273d7a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/filetransfers_window.py
+20
-0
20 additions, 0 deletions
src/filetransfers_window.py
with
20 additions
and
0 deletions
src/filetransfers_window.py
+
20
−
0
View file @
5ed2e230
...
...
@@ -112,6 +112,7 @@ def __init__(self, plugin):
popup_xml
.
signal_autoconnect
(
self
)
def
show_completed
(
self
,
jid
,
file_props
):
'''
show a dialog saying that file (file_props) has been transferred
'''
self
.
window
.
present
()
self
.
window
.
window
.
focus
()
sectext
=
'
\t
'
+
_
(
'
Filename: %s
'
)
%
\
...
...
@@ -166,12 +167,16 @@ def show_completed(self, jid, file_props):
self
.
tree
.
get_selection
().
unselect_all
()
def
show_request_error
(
self
,
file_props
):
'''
show error dialog to the recipient saying that transfer
has been canceled
'''
self
.
window
.
present
()
self
.
window
.
window
.
focus
()
dialogs
.
InformationDialog
(
_
(
'
File transfer canceled
'
),
_
(
'
Connection with peer cannot be established.
'
))
self
.
tree
.
get_selection
().
unselect_all
()
def
show_send_error
(
self
,
file_props
):
'''
show error dialog to the sender saying that transfer
has been canceled
'''
self
.
window
.
present
()
self
.
window
.
window
.
focus
()
dialogs
.
InformationDialog
(
_
(
'
File transfer canceled
'
),
...
...
@@ -214,6 +219,7 @@ def show_file_send_request(self, account, contact):
dialog
.
destroy
()
def
send_file
(
self
,
account
,
contact
,
file_path
):
'''
start the real transfer(upload) of the file
'''
(
file_dir
,
file_name
)
=
os
.
path
.
split
(
file_path
)
file_props
=
self
.
get_send_file_props
(
account
,
contact
,
file_path
,
file_name
)
...
...
@@ -221,6 +227,8 @@ def send_file(self, account, contact, file_path):
gajim
.
connections
[
account
].
send_file_request
(
file_props
)
def
show_file_request
(
self
,
account
,
contact
,
file_props
):
'''
show dialog asking for comfirmation and store location of new
file requested by a contact
'''
if
file_props
is
None
or
not
file_props
.
has_key
(
'
name
'
):
return
sec_text
=
'
\t
'
+
_
(
'
File: %s
'
)
%
\
...
...
@@ -270,6 +278,7 @@ def show_file_request(self, account, contact, file_props):
gajim
.
connections
[
account
].
send_file_rejection
(
file_props
)
def
set_images
(
self
):
'''
create pixbufs for status images in transfer rows
'''
self
.
images
=
{}
self
.
images
[
'
upload
'
]
=
self
.
window
.
render_icon
(
gtk
.
STOCK_GO_UP
,
gtk
.
ICON_SIZE_MENU
)
...
...
@@ -287,6 +296,7 @@ def set_images(self):
gtk
.
ICON_SIZE_MENU
)
def
set_status
(
self
,
typ
,
sid
,
status
):
'''
change the status of a transfer to state
'
status
'
'''
iter
=
self
.
get_iter_by_sid
(
typ
,
sid
)
if
iter
is
None
:
return
...
...
@@ -299,6 +309,7 @@ def set_status(self, typ, sid, status):
self
.
model
.
set
(
iter
,
0
,
self
.
images
[
status
])
def
set_progress
(
self
,
typ
,
sid
,
transfered_size
,
iter
=
None
):
'''
change the progress of a transfer with new transfered size
'''
if
not
self
.
files_props
[
typ
].
has_key
(
sid
):
return
file_props
=
self
.
files_props
[
typ
][
sid
]
...
...
@@ -341,6 +352,7 @@ def get_iter_by_sid(self, typ, sid):
iter
=
self
.
model
.
iter_next
(
iter
)
def
get_sid
(
self
):
'''
create random string of length 16
'''
rng
=
range
(
65
,
90
)
rng
.
extend
(
range
(
48
,
57
))
char_sequence
=
map
(
lambda
e
:
chr
(
e
),
rng
)
...
...
@@ -349,6 +361,8 @@ def get_sid(self):
sample
(
char_sequence
,
16
))
def
get_send_file_props
(
self
,
account
,
contact
,
file_path
,
file_name
):
'''
create new file_props dict and set initial file transfer
properties in it
'''
file_props
=
{
'
file-name
'
:
file_path
,
'
name
'
:
file_name
,
'
type
'
:
'
s
'
}
if
os
.
path
.
exists
(
file_path
)
and
os
.
path
.
isfile
(
file_path
):
...
...
@@ -364,6 +378,7 @@ def get_send_file_props(self, account, contact, file_path, file_name):
return
file_props
def
add_transfer
(
self
,
account
,
contact
,
file_props
):
'''
add new transfer to FT window and show the FT window
'''
self
.
on_transfers_list_leave_notify_event
(
None
)
if
file_props
is
None
:
return
...
...
@@ -460,6 +475,7 @@ def is_transfer_stoped(self, file_props):
return
True
def
set_all_insensitive
(
self
):
'''
make all buttons/menuitems insensitive
'''
self
.
pause_button
.
set_sensitive
(
False
)
self
.
pause_menuitem
.
set_sensitive
(
False
)
self
.
continue_menuitem
.
set_sensitive
(
False
)
...
...
@@ -470,6 +486,8 @@ def set_all_insensitive(self):
self
.
open_folder_menuitem
.
set_sensitive
(
False
)
def
set_buttons_sensitive
(
self
,
path
,
is_row_selected
):
'''
make buttons/menuitems sensitive as appropriate to
the state of file transfer located at path
'
path
'
'''
if
path
is
None
:
self
.
set_all_insensitive
()
return
...
...
@@ -507,6 +525,8 @@ def set_buttons_sensitive(self, path, is_row_selected):
return
True
def
selection_changed
(
self
,
args
):
'''
selection has changed - change the sensitivity of the
buttons/menuitems
'''
selection
=
args
selected
=
selection
.
get_selected_rows
()
if
selected
[
1
]
!=
[]:
...
...
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