Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
gajim-plugins
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
gajim
gajim-plugins
Commits
9457a180
Commit
9457a180
authored
8 years ago
by
Linus
Browse files
Options
Downloads
Patches
Plain Diff
httpupload: Fix GTK warnings
Episode 2: no core changes required
parent
7f5c1448
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!41
Improved error messages
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
httpupload/httpupload.py
+13
-9
13 additions, 9 deletions
httpupload/httpupload.py
with
13 additions
and
9 deletions
httpupload/httpupload.py
+
13
−
9
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
)
...
...
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