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
73461bdb
Commit
73461bdb
authored
18 years ago
by
Liorithiel
Browse files
Options
Downloads
Patches
Plain Diff
Cancel and close buttons merged into one.
parent
2ca94a53
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
data/glade/adhoc_commands_window.glade
+13
-39
13 additions, 39 deletions
data/glade/adhoc_commands_window.glade
src/adhoc_commands.py
+30
-43
30 additions, 43 deletions
src/adhoc_commands.py
with
43 additions
and
82 deletions
data/glade/adhoc_commands_window.glade
+
13
−
39
View file @
73461bdb
...
...
@@ -670,53 +670,24 @@
<property
name=
"spacing"
>
0
</property>
<child>
<widget
class=
"GtkHBox"
id=
"hbox2958"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"homogeneous"
>
False
</property>
<property
name=
"spacing"
>
0
</property>
<child>
<widget
class=
"GtkButton"
id=
"cancel_button"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"label"
>
gtk-cancel
</property>
<property
name=
"use_stock"
>
True
</property>
<property
name=
"relief"
>
GTK_RELIEF_NORMAL
</property>
<property
name=
"focus_on_click"
>
True
</property>
<signal
name=
"clicked"
handler=
"on_cancel_button_clicked"
last_modification_time=
"Mon, 10 Jul 2006 16:24:32 GMT"
/>
</widget>
<packing>
<property
name=
"padding"
>
0
</property>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
False
</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property
name=
"padding"
>
3
</property>
<property
name=
"expand"
>
True
</property>
<property
name=
"fill"
>
True
</property>
</packing>
<placeholder/>
</child>
<child>
<widget
class=
"GtkButton"
id=
"
back
_button"
>
<widget
class=
"GtkButton"
id=
"
execute
_button"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"label"
>
gtk-
go-back
</property>
<property
name=
"label"
>
gtk-
execute
</property>
<property
name=
"use_stock"
>
True
</property>
<property
name=
"relief"
>
GTK_RELIEF_NORMAL
</property>
<property
name=
"focus_on_click"
>
True
</property>
<signal
name=
"clicked"
handler=
"on_
back
_button_clicked"
last_modification_time=
"Mon, 10 Jul 2006 16:24:
50
GMT"
/>
<signal
name=
"clicked"
handler=
"on_
execute
_button_clicked"
last_modification_time=
"Mon, 10 Jul 2006 16:24:
42
GMT"
/>
</widget>
<packing>
<property
name=
"padding"
>
0
</property>
<property
name=
"padding"
>
3
</property>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
False
</property>
<property
name=
"pack_type"
>
GTK_PACK_END
</property>
</packing>
</child>
...
...
@@ -734,23 +705,25 @@
<property
name=
"padding"
>
3
</property>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
False
</property>
<property
name=
"pack_type"
>
GTK_PACK_END
</property>
</packing>
</child>
<child>
<widget
class=
"GtkButton"
id=
"
execute
_button"
>
<widget
class=
"GtkButton"
id=
"
back
_button"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"label"
>
gtk-
execute
</property>
<property
name=
"label"
>
gtk-
go-back
</property>
<property
name=
"use_stock"
>
True
</property>
<property
name=
"relief"
>
GTK_RELIEF_NORMAL
</property>
<property
name=
"focus_on_click"
>
True
</property>
<signal
name=
"clicked"
handler=
"on_
execute
_button_clicked"
last_modification_time=
"Mon, 10 Jul 2006 16:24:
42
GMT"
/>
<signal
name=
"clicked"
handler=
"on_
back
_button_clicked"
last_modification_time=
"Mon, 10 Jul 2006 16:24:
50
GMT"
/>
</widget>
<packing>
<property
name=
"padding"
>
3
</property>
<property
name=
"padding"
>
0
</property>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
False
</property>
<property
name=
"pack_type"
>
GTK_PACK_END
</property>
</packing>
</child>
...
...
@@ -767,6 +740,7 @@
<property
name=
"padding"
>
3
</property>
<property
name=
"expand"
>
False
</property>
<property
name=
"fill"
>
False
</property>
<property
name=
"pack_type"
>
GTK_PACK_END
</property>
</packing>
</child>
</widget>
...
...
This diff is collapsed.
Click to expand it.
src/adhoc_commands.py
+
30
−
43
View file @
73461bdb
...
...
@@ -60,7 +60,7 @@ def __init__(self, account, jid):
# retrieving widgets from xml
self
.
xml
=
gtkgui_helpers
.
get_glade
(
'
adhoc_commands_window.glade
'
)
self
.
window
=
self
.
xml
.
get_widget
(
'
adhoc_commands_window
'
)
for
name
in
(
'
cancel_button
'
,
'
back_button
'
,
'
forward_button
'
,
for
name
in
(
'
back_button
'
,
'
forward_button
'
,
'
execute_button
'
,
'
close_button
'
,
'
stages_notebook
'
,
'
retrieving_commands_stage_vbox
'
,
'
command_list_stage_vbox
'
,
'
command_list_vbox
'
,
...
...
@@ -75,7 +75,6 @@ def __init__(self, account, jid):
self
.
sending_form_stage_vbox
.
pack_start
(
self
.
data_form_widget
)
# setting initial stage
self
.
close_button
.
set_no_show_all
(
True
)
self
.
stage1
()
# displaying the window
...
...
@@ -84,7 +83,6 @@ def __init__(self, account, jid):
# these functions are set up by appropriate stageX methods
def
stage_finish
(
self
,
*
anything
):
pass
def
stage_cancel_button_clicked
(
self
,
*
anything
):
assert
False
def
stage_back_button_clicked
(
self
,
*
anything
):
assert
False
def
stage_forward_button_clicked
(
self
,
*
anything
):
assert
False
def
stage_execute_button_clicked
(
self
,
*
anything
):
assert
False
...
...
@@ -93,9 +91,6 @@ def stage_adhoc_commands_window_delete_event(self, *anything): assert False
def
do_nothing
(
self
,
*
anything
):
return
False
# widget callbacks
def
on_cancel_button_clicked
(
self
,
*
anything
):
return
self
.
stage_cancel_button_clicked
(
*
anything
)
def
on_back_button_clicked
(
self
,
*
anything
):
return
self
.
stage_back_button_clicked
(
*
anything
)
...
...
@@ -131,7 +126,7 @@ def stage1(self):
self
.
retrieving_commands_stage_vbox
))
# set widgets' state
self
.
c
ancel
_button
.
set_sensitive
(
True
)
self
.
c
lose
_button
.
set_sensitive
(
True
)
self
.
back_button
.
set_sensitive
(
False
)
self
.
forward_button
.
set_sensitive
(
False
)
self
.
execute_button
.
set_sensitive
(
False
)
...
...
@@ -143,13 +138,13 @@ def stage1(self):
# setup the callbacks
self
.
stage_finish
=
self
.
stage1_finish
self
.
stage_c
ancel
_button_clicked
=
self
.
stage1_c
ancel
_button_clicked
self
.
stage_c
lose
_button_clicked
=
self
.
stage1_c
lose
_button_clicked
self
.
stage_adhoc_commands_window_delete_event
=
self
.
stage1_adhoc_commands_window_delete_event
def
stage1_finish
(
self
):
self
.
remove_pulsing
()
def
stage1_c
ancel
_button_clicked
(
self
,
widget
):
def
stage1_c
lose
_button_clicked
(
self
,
widget
):
# cancelling in this stage is not critical, so we don't
# show any popups to user
self
.
stage1_finish
()
...
...
@@ -173,7 +168,7 @@ def stage2(self):
self
.
stages_notebook
.
page_num
(
self
.
command_list_stage_vbox
))
self
.
c
ancel
_button
.
set_sensitive
(
True
)
self
.
c
lose
_button
.
set_sensitive
(
True
)
self
.
back_button
.
set_sensitive
(
False
)
self
.
forward_button
.
set_sensitive
(
True
)
self
.
execute_button
.
set_sensitive
(
False
)
...
...
@@ -190,7 +185,7 @@ def stage2(self):
self
.
command_list_vbox
.
show_all
()
self
.
stage_finish
=
self
.
stage2_finish
self
.
stage_c
ancel
_button_clicked
=
self
.
stage2_c
ancel
_button_clicked
self
.
stage_c
lose
_button_clicked
=
self
.
stage2_c
lose
_button_clicked
self
.
stage_forward_button_clicked
=
self
.
stage2_forward_button_clicked
self
.
stage_adhoc_commands_window_delete_event
=
self
.
do_nothing
...
...
@@ -200,7 +195,7 @@ def remove_widget(widget):
self
.
command_list_vbox
.
remove
(
widget
)
self
.
command_list_vbox
.
foreach
(
remove_widget
)
def
stage2_c
ancel
_button_clicked
(
self
,
widget
):
def
stage2_c
lose
_button_clicked
(
self
,
widget
):
self
.
stage_finish
()
self
.
window
.
destroy
()
...
...
@@ -226,7 +221,7 @@ def stage3(self):
self
.
stages_notebook
.
page_num
(
self
.
sending_form_stage_vbox
))
self
.
c
ancel
_button
.
set_sensitive
(
True
)
self
.
c
lose
_button
.
set_sensitive
(
True
)
self
.
back_button
.
set_sensitive
(
False
)
self
.
forward_button
.
set_sensitive
(
False
)
self
.
execute_button
.
set_sensitive
(
False
)
...
...
@@ -234,22 +229,25 @@ def stage3(self):
self
.
stage3_submit_form
()
self
.
stage_finish
=
self
.
stage3_finish
self
.
stage_cancel_button_clicked
=
self
.
stage3_cancel_button_clicked
self
.
stage_back_button_clicked
=
self
.
stage3_back_button_clicked
self
.
stage_forward_button_clicked
=
self
.
stage3_forward_button_clicked
self
.
stage_execute_button_clicked
=
self
.
stage3_execute_button_clicked
self
.
stage_close_button_clicked
=
self
.
stage3_close_button_clicked
self
.
stage_adhoc_commands_window_delete_event
=
self
.
stage3_c
ancel
_button_clicked
self
.
stage_adhoc_commands_window_delete_event
=
self
.
stage3_c
lose
_button_clicked
def
stage3_finish
(
self
):
pass
def
stage3_c
ancel
_button_clicked
(
self
,
widget
,
*
anything
):
def
stage3_c
lose
_button_clicked
(
self
,
widget
):
'''
We are in the middle of executing command. Ask user if he really want to cancel
the process, then... cancel it.
'''
# this works also as a handler for window_delete_event, so we have to return appropriate
# values
# TODO: translate it
if
self
.
form_status
==
'
completed
'
:
if
widget
!=
self
.
window
:
self
.
window
.
destroy
()
return
False
dialog
=
dialogs
.
HigDialog
(
self
.
window
,
gtk
.
DIALOG_DESTROY_WITH_PARENT
|
gtk
.
DIALOG_MODAL
,
gtk
.
BUTTONS_YES_NO
,
'
Cancel confirmation
'
,
'
You are in process of executing command. Do you really want to cancel it?
'
)
...
...
@@ -261,15 +259,6 @@ def stage3_cancel_button_clicked(self, widget, *anything):
else
:
self
.
window
.
destroy
()
return
False
return
True
def
stage3_close_button_clicked
(
self
,
widget
):
# this works also as a handler for window_delete_event, so we have to return appropriate
# values
if
widget
==
self
.
window
:
return
False
else
:
self
.
window
.
destroy
()
def
stage3_back_button_clicked
(
self
,
widget
):
self
.
stage3_submit_form
(
'
prev
'
)
...
...
@@ -285,7 +274,7 @@ def stage3_submit_form(self, action='execute'):
if
self
.
data_form_widget
.
get_data_form
()
is
None
:
self
.
data_form_widget
.
hide
()
self
.
c
ancel
_button
.
set_sensitive
(
True
)
self
.
c
lose
_button
.
set_sensitive
(
True
)
self
.
back_button
.
set_sensitive
(
False
)
self
.
forward_button
.
set_sensitive
(
False
)
self
.
execute_button
.
set_sensitive
(
False
)
...
...
@@ -320,24 +309,22 @@ def stage3_next_form(self, command):
action
=
command
.
getTag
(
'
action
'
)
if
action
is
None
:
self
.
c
ancel
_button
.
set_sensitive
(
True
)
self
.
c
lose
_button
.
set_sensitive
(
True
)
self
.
back_button
.
set_sensitive
(
False
)
self
.
forward_button
.
set_sensitive
(
False
)
self
.
execute_button
.
set_sensitive
(
True
)
else
:
# actions, actions, actions...
self
.
c
ancel
_button
.
set_sensitive
(
True
)
self
.
c
lose
_button
.
set_sensitive
(
True
)
self
.
back_button
.
set_sensitive
(
action
.
getTag
(
'
prev
'
)
is
not
None
)
self
.
forward_button
.
set_sensitive
(
action
.
getTag
(
'
next
'
)
is
not
None
)
self
.
execute_button
.
set_sensitive
(
True
)
if
self
.
form_status
==
'
completed
'
:
self
.
cancel_button
.
set_sensitive
(
False
)
self
.
back_button
.
set_sensitive
(
False
)
self
.
forward_button
.
set_sensitive
(
False
)
self
.
execute_button
.
set_no_show_all
(
True
)
self
.
close_button
.
set_sensitive
(
True
)
self
.
back_button
.
hide
()
self
.
forward_button
.
hide
()
self
.
execute_button
.
hide
()
self
.
close_button
.
set_no_show_all
(
False
)
self
.
close_button
.
show
()
self
.
stage_adhoc_commands_window_delete_event
=
self
.
stage3_close_button_clicked
...
...
@@ -360,16 +347,16 @@ def stage4(self):
self
.
stages_notebook
.
page_num
(
self
.
no_commands_stage_vbox
))
self
.
c
ancel
_button
.
set_sensitive
(
True
)
self
.
c
lose
_button
.
set_sensitive
(
True
)
self
.
back_button
.
set_sensitive
(
False
)
self
.
forward_button
.
set_sensitive
(
False
)
self
.
execute_button
.
set_sensitive
(
False
)
self
.
stage_finish
=
self
.
do_nothing
self
.
stage_c
ancel
_button_clicked
=
self
.
stage4_c
ancel
_button_clicked
self
.
stage_c
lose
_button_clicked
=
self
.
stage4_c
lose
_button_clicked
self
.
stage_adhoc_commands_window_delete_event
=
self
.
do_nothing
def
stage4_c
ancel
_button_clicked
(
self
,
widget
):
def
stage4_c
lose
_button_clicked
(
self
,
widget
):
self
.
window
.
destroy
()
def
on_check_commands_2_button_clicked
(
self
,
widget
):
...
...
@@ -401,18 +388,18 @@ def stage5(self, error=None, errorid=None, senderror=False):
self
.
stages_notebook
.
page_num
(
self
.
error_stage_vbox
))
self
.
c
ancel
_button
.
set_sensitive
(
True
)
self
.
back_button
.
set_sensitive
(
False
)
self
.
forward_button
.
set_sensitive
(
False
)
self
.
execute_button
.
set_sensitive
(
False
)
self
.
c
lose
_button
.
set_sensitive
(
True
)
self
.
back_button
.
hide
(
)
self
.
forward_button
.
hide
(
)
self
.
execute_button
.
hide
(
)
self
.
error_description_label
.
set_text
(
error
)
self
.
stage_finish
=
self
.
do_nothing
self
.
stage_c
ancel
_button_clicked
=
self
.
stage5_c
ancel
_button_clicked
self
.
stage_c
lose
_button_clicked
=
self
.
stage5_c
lose
_button_clicked
self
.
stage_adhoc_commands_window_delete_event
=
self
.
do_nothing
def
stage5_c
ancel
_button_clicked
(
self
,
widget
):
def
stage5_c
lose
_button_clicked
(
self
,
widget
):
self
.
window
.
destroy
()
# helpers to handle pulsing in progressbar
...
...
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