we use \t to indent !
This commit is contained in:
parent
ffd8c05b9e
commit
d6b7766ec0
1 changed files with 62 additions and 62 deletions
124
src/dialogs.py
124
src/dialogs.py
|
@ -404,62 +404,62 @@ class AboutDialog:
|
||||||
dlg.destroy()
|
dlg.destroy()
|
||||||
|
|
||||||
class Dialog(gtk.Dialog):
|
class Dialog(gtk.Dialog):
|
||||||
def __init__(self, parent, title, buttons, default = None):
|
def __init__(self, parent, title, buttons, default = None):
|
||||||
gtk.Dialog.__init__(self, title, parent, gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_MODAL | gtk.DIALOG_NO_SEPARATOR)
|
gtk.Dialog.__init__(self, title, parent, gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_MODAL | gtk.DIALOG_NO_SEPARATOR)
|
||||||
|
|
||||||
self.set_border_width(6)
|
self.set_border_width(6)
|
||||||
self.vbox.set_spacing(12)
|
self.vbox.set_spacing(12)
|
||||||
self.set_resizable(False)
|
self.set_resizable(False)
|
||||||
|
|
||||||
for stock, response in buttons:
|
for stock, response in buttons:
|
||||||
self.add_button(stock, response)
|
self.add_button(stock, response)
|
||||||
|
|
||||||
if default is not None:
|
if default is not None:
|
||||||
self.set_default_response(default)
|
self.set_default_response(default)
|
||||||
else:
|
else:
|
||||||
self.set_default_response(buttons[-1][1])
|
self.set_default_response(buttons[-1][1])
|
||||||
|
|
||||||
def get_button(self, index):
|
def get_button(self, index):
|
||||||
buttons = self.action_area.get_children()
|
buttons = self.action_area.get_children()
|
||||||
return index < len(buttons) and buttons[index] or None
|
return index < len(buttons) and buttons[index] or None
|
||||||
|
|
||||||
|
|
||||||
class HigDialog(Dialog):
|
class HigDialog(Dialog):
|
||||||
def __init__(self, parent, pritext, sectext, stockimage, buttons, default = None):
|
def __init__(self, parent, pritext, sectext, stockimage, buttons, default = None):
|
||||||
"""GNOME higified version of the Dialog object. Inherit
|
"""GNOME higified version of the Dialog object. Inherit
|
||||||
from here if possible when you need a new dialog."""
|
from here if possible when you need a new dialog."""
|
||||||
Dialog.__init__(self, parent, "", buttons, default)
|
Dialog.__init__(self, parent, "", buttons, default)
|
||||||
|
|
||||||
# hbox separating dialog image and contents
|
# hbox separating dialog image and contents
|
||||||
hbox = gtk.HBox()
|
hbox = gtk.HBox()
|
||||||
hbox.set_spacing(12)
|
hbox.set_spacing(12)
|
||||||
hbox.set_border_width(6)
|
hbox.set_border_width(6)
|
||||||
self.vbox.pack_start(hbox)
|
self.vbox.pack_start(hbox)
|
||||||
|
|
||||||
# set up image
|
# set up image
|
||||||
if stockimage is not None:
|
if stockimage is not None:
|
||||||
image = gtk.Image()
|
image = gtk.Image()
|
||||||
image.set_from_stock(stockimage, gtk.ICON_SIZE_DIALOG)
|
image.set_from_stock(stockimage, gtk.ICON_SIZE_DIALOG)
|
||||||
image.set_alignment(0.5, 0)
|
image.set_alignment(0.5, 0)
|
||||||
hbox.pack_start(image, False, False)
|
hbox.pack_start(image, False, False)
|
||||||
|
|
||||||
# set up main content area
|
# set up main content area
|
||||||
self.contents = gtk.VBox()
|
self.contents = gtk.VBox()
|
||||||
self.contents.set_spacing(10)
|
self.contents.set_spacing(10)
|
||||||
hbox.pack_start(self.contents)
|
hbox.pack_start(self.contents)
|
||||||
|
|
||||||
label = gtk.Label()
|
label = gtk.Label()
|
||||||
label.set_markup("<span size=\"larger\" weight=\"bold\">" + pritext + "</span>\n\n" + sectext)
|
label.set_markup("<span size=\"larger\" weight=\"bold\">" + pritext + "</span>\n\n" + sectext)
|
||||||
label.set_line_wrap(True)
|
label.set_line_wrap(True)
|
||||||
label.set_alignment(0, 0)
|
label.set_alignment(0, 0)
|
||||||
label.set_selectable(True)
|
label.set_selectable(True)
|
||||||
self.contents.pack_start(label)
|
self.contents.pack_start(label)
|
||||||
|
|
||||||
def get_response(self):
|
def get_response(self):
|
||||||
self.show_all()
|
self.show_all()
|
||||||
response = gtk.Dialog.run(self)
|
response = gtk.Dialog.run(self)
|
||||||
self.destroy()
|
self.destroy()
|
||||||
return response
|
return response
|
||||||
|
|
||||||
class ConfirmationDialog(HigDialog):
|
class ConfirmationDialog(HigDialog):
|
||||||
"""HIG compliant confirmation dialog."""
|
"""HIG compliant confirmation dialog."""
|
||||||
|
@ -469,20 +469,20 @@ class ConfirmationDialog(HigDialog):
|
||||||
[ gtk.STOCK_OK, gtk.RESPONSE_OK ] ])
|
[ gtk.STOCK_OK, gtk.RESPONSE_OK ] ])
|
||||||
|
|
||||||
class WarningDialog(HigDialog):
|
class WarningDialog(HigDialog):
|
||||||
def __init__(self, pritext, sectext=''):
|
def __init__(self, pritext, sectext=''):
|
||||||
"""HIG compliant warning dialog."""
|
"""HIG compliant warning dialog."""
|
||||||
HigDialog.__init__(
|
HigDialog.__init__(
|
||||||
self, None, pritext, sectext, gtk.STOCK_DIALOG_WARNING,
|
self, None, pritext, sectext, gtk.STOCK_DIALOG_WARNING,
|
||||||
[ [ gtk.STOCK_OK, gtk.RESPONSE_OK ] ]
|
[ [ gtk.STOCK_OK, gtk.RESPONSE_OK ] ]
|
||||||
)
|
)
|
||||||
|
|
||||||
class InformationDialog(HigDialog):
|
class InformationDialog(HigDialog):
|
||||||
def __init__(self, pritext, sectext=''):
|
def __init__(self, pritext, sectext=''):
|
||||||
"""HIG compliant info dialog."""
|
"""HIG compliant info dialog."""
|
||||||
HigDialog.__init__(
|
HigDialog.__init__(
|
||||||
self, None, pritext, sectext, gtk.STOCK_DIALOG_INFO,
|
self, None, pritext, sectext, gtk.STOCK_DIALOG_INFO,
|
||||||
[ [ gtk.STOCK_OK, gtk.RESPONSE_OK ] ]
|
[ [ gtk.STOCK_OK, gtk.RESPONSE_OK ] ]
|
||||||
)
|
)
|
||||||
|
|
||||||
class InputDialog:
|
class InputDialog:
|
||||||
'''Class for Input dialog'''
|
'''Class for Input dialog'''
|
||||||
|
@ -498,12 +498,12 @@ class InputDialog:
|
||||||
self.input_entry.select_region(0, -1) # select all
|
self.input_entry.select_region(0, -1) # select all
|
||||||
|
|
||||||
class ErrorDialog(HigDialog):
|
class ErrorDialog(HigDialog):
|
||||||
def __init__(self, pritext, sectext=''):
|
def __init__(self, pritext, sectext=''):
|
||||||
"""HIG compliant error dialog."""
|
"""HIG compliant error dialog."""
|
||||||
HigDialog.__init__(
|
HigDialog.__init__(
|
||||||
self, None, pritext, sectext, gtk.STOCK_DIALOG_ERROR,
|
self, None, pritext, sectext, gtk.STOCK_DIALOG_ERROR,
|
||||||
[ [ gtk.STOCK_OK, gtk.RESPONSE_OK ] ]
|
[ [ gtk.STOCK_OK, gtk.RESPONSE_OK ] ]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class Subscription_request_window:
|
class Subscription_request_window:
|
||||||
|
|
Loading…
Add table
Reference in a new issue