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
G
gajim-plugins
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
56
Issues
56
List
Boards
Labels
Service Desk
Milestones
Merge Requests
8
Merge Requests
8
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gajim
gajim-plugins
Commits
9457a180
Commit
9457a180
authored
Aug 22, 2016
by
Linus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
httpupload: Fix GTK warnings
Episode 2: no core changes required
parent
7f5c1448
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
httpupload/httpupload.py
httpupload/httpupload.py
+13
-9
No files found.
httpupload/httpupload.py
View file @
9457a180
...
...
@@ -273,7 +273,8 @@ class Base(object):
mime_type
=
'application/octet-stream'
# fallback mime type
log
.
info
(
"Detected MIME Type of file: "
+
str
(
mime_type
))
progress_messages
=
Queue
(
8
)
progress_window
=
ProgressWindow
(
_
(
'HTTP Upload'
),
_
(
'Requesting HTTP Upload Slot...'
),
progress_messages
,
self
.
plugin
)
progress_window
=
ProgressWindow
(
_
(
'HTTP Upload'
),
_
(
'Requesting HTTP Upload Slot...'
),
progress_messages
,
self
.
plugin
,
parent
=
self
.
chat_control
.
parent_win
.
window
)
def
upload_file
(
stanza
):
slot
=
stanza
.
getTag
(
"slot"
)
if
not
slot
:
...
...
@@ -437,10 +438,12 @@ class Base(object):
title_text
=
_
(
'Choose file to send'
),
action
=
Gtk
.
FileChooserAction
.
OPEN
,
buttons
=
(
Gtk
.
STOCK_CANCEL
,
Gtk
.
ResponseType
.
CANCEL
,
Gtk
.
STOCK_OPEN
,
Gtk
.
ResponseType
.
OK
),
default_response
=
Gtk
.
ResponseType
.
OK
,)
self
.
dlg
.
set_transient_for
(
self
.
chat_control
.
parent_win
.
window
)
def
on_image_button_clicked
(
self
,
widget
):
self
.
dialog_type
=
'image'
self
.
dlg
=
ImageChooserDialog
(
on_response_ok
=
self
.
on_file_dialog_ok
,
on_response_cancel
=
None
)
self
.
dlg
.
set_transient_for
(
self
.
chat_control
.
parent_win
.
window
)
class
StreamFileWithProgress
:
...
...
@@ -490,11 +493,12 @@ class StreamFileWithProgress:
class
ProgressWindow
:
def
__init__
(
self
,
title_text
,
during_text
,
messages_queue
,
plugin
):
def
__init__
(
self
,
title_text
,
during_text
,
messages_queue
,
plugin
,
parent
):
self
.
plugin
=
plugin
self
.
xml
=
gtkgui_helpers
.
get_gtk_builder
(
self
.
plugin
.
local_file_path
(
'upload_progress_dialog.ui'
))
self
.
messages_queue
=
messages_queue
self
.
dialog
=
self
.
xml
.
get_object
(
'progress_dialog'
)
self
.
dialog
.
set_transient_for
(
parent
)
self
.
label
=
self
.
xml
.
get_object
(
'label'
)
self
.
cancel_button
=
self
.
xml
.
get_object
(
'close_button'
)
self
.
label
.
set_markup
(
'<big>'
+
during_text
+
'</big>'
)
...
...
@@ -507,8 +511,8 @@ class ProgressWindow:
self
.
xml
.
connect_signals
(
self
)
self
.
stopped
=
False
self
.
pulse_progressbar_timeout_id
=
G
Object
.
timeout_add
(
100
,
self
.
pulse_progressbar
)
self
.
process_messages_queue_timeout_id
=
G
Object
.
timeout_add
(
100
,
self
.
process_messages_queue
)
self
.
pulse_progressbar_timeout_id
=
G
Lib
.
timeout_add
(
100
,
self
.
pulse_progressbar
)
self
.
process_messages_queue_timeout_id
=
G
Lib
.
timeout_add
(
100
,
self
.
process_messages_queue
)
def
pulse_progressbar
(
self
):
...
...
@@ -527,21 +531,21 @@ class ProgressWindow:
def
on_progress_dialog_delete_event
(
self
,
widget
,
event
):
self
.
stopped
=
True
if
self
.
pulse_progressbar_timeout_id
:
G
Object
.
source_remove
(
self
.
pulse_progressbar_timeout_id
)
G
Object
.
source_remove
(
self
.
process_messages_queue_timeout_id
)
G
Lib
.
source_remove
(
self
.
pulse_progressbar_timeout_id
)
G
Lib
.
source_remove
(
self
.
process_messages_queue_timeout_id
)
def
on_cancel
(
self
,
widget
):
self
.
stopped
=
True
if
self
.
pulse_progressbar_timeout_id
:
G
Object
.
source_remove
(
self
.
pulse_progressbar_timeout_id
)
G
Object
.
source_remove
(
self
.
process_messages_queue_timeout_id
)
G
Lib
.
source_remove
(
self
.
pulse_progressbar_timeout_id
)
G
Lib
.
source_remove
(
self
.
process_messages_queue_timeout_id
)
self
.
dialog
.
destroy
()
def
update_progress
(
self
,
seen
,
total
):
if
self
.
stopped
==
True
:
raise
UploadAbortedException
if
self
.
pulse_progressbar_timeout_id
:
G
Object
.
source_remove
(
self
.
pulse_progressbar_timeout_id
)
G
Lib
.
source_remove
(
self
.
pulse_progressbar_timeout_id
)
self
.
pulse_progressbar_timeout_id
=
None
pct
=
(
float
(
seen
)
/
total
)
*
100.0
self
.
progressbar
.
set_fraction
(
float
(
seen
)
/
total
)
...
...
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