mirror of
https://github.com/gryf/pygtktalog.git
synced 2025-12-17 11:30:19 +01:00
* Code clean up.
* Adapted to PEP8.
This commit is contained in:
@@ -68,13 +68,13 @@ class ConfigController(Controller):
|
|||||||
self.__setup_category_tree()
|
self.__setup_category_tree()
|
||||||
|
|
||||||
# initialize models for files extensions
|
# initialize models for files extensions
|
||||||
self.view['extension_tree'].get_selection().set_mode(gtk.SELECTION_MULTIPLE)
|
vi = self.view['extension_tree']
|
||||||
|
vi.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
|
||||||
#self.view['extension_tree'].set_model(self.model.ext_tree)
|
#self.view['extension_tree'].set_model(self.model.ext_tree)
|
||||||
self.__setup_extension_tree()
|
self.__setup_extension_tree()
|
||||||
|
|
||||||
self.view['config'].show();
|
self.view['config'].show()
|
||||||
return
|
return
|
||||||
# Podłącz sygnały:
|
|
||||||
|
|
||||||
#################
|
#################
|
||||||
# connect signals
|
# connect signals
|
||||||
@@ -92,10 +92,12 @@ class ConfigController(Controller):
|
|||||||
iterator = tree.get_model().get_iter_first();
|
iterator = tree.get_model().get_iter_first();
|
||||||
while iterator != None:
|
while iterator != None:
|
||||||
if model.get_value(iterator, 0) == selected:
|
if model.get_value(iterator, 0) == selected:
|
||||||
self.view[self.category_dict[model.get_value(iterator, 0)]].show()
|
self.view[self.category_dict[model.get_value(iterator,
|
||||||
|
0)]].show()
|
||||||
self.view['desc'].set_markup("<b>%s</b>" % selected)
|
self.view['desc'].set_markup("<b>%s</b>" % selected)
|
||||||
else:
|
else:
|
||||||
self.view[self.category_dict[model.get_value(iterator, 0)]].hide()
|
self.view[self.category_dict[model.get_value(iterator,
|
||||||
|
0)]].hide()
|
||||||
iterator = tree.get_model().iter_next(iterator);
|
iterator = tree.get_model().iter_next(iterator);
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -114,7 +116,8 @@ class ConfigController(Controller):
|
|||||||
self.model.confd['confirmquit'] = self.view['ch_quit'].get_active()
|
self.model.confd['confirmquit'] = self.view['ch_quit'].get_active()
|
||||||
self.model.confd['mntwarn'] = self.view['ch_wrnmount'].get_active()
|
self.model.confd['mntwarn'] = self.view['ch_wrnmount'].get_active()
|
||||||
self.model.confd['delwarn'] = self.view['ch_wrndel'].get_active()
|
self.model.confd['delwarn'] = self.view['ch_wrndel'].get_active()
|
||||||
self.model.confd['confirmabandon'] = self.view['ch_warnnew'].get_active()
|
v = self.view['ch_warnnew']
|
||||||
|
self.model.confd['confirmabandon'] = v.get_active()
|
||||||
self.model.confd['thumbs'] = self.view['ch_thumb'].get_active()
|
self.model.confd['thumbs'] = self.view['ch_thumb'].get_active()
|
||||||
self.model.confd['exif'] = self.view['ch_exif'].get_active()
|
self.model.confd['exif'] = self.view['ch_exif'].get_active()
|
||||||
self.model.confd['gthumb'] = self.view['ch_gthumb'].get_active()
|
self.model.confd['gthumb'] = self.view['ch_gthumb'].get_active()
|
||||||
@@ -149,7 +152,8 @@ class ConfigController(Controller):
|
|||||||
ext = self.view['ext_entry'].get_text().lower()
|
ext = self.view['ext_entry'].get_text().lower()
|
||||||
com = self.view['com_entry'].get_text()
|
com = self.view['com_entry'].get_text()
|
||||||
if len(ext) == 0 and len(com) == 0:
|
if len(ext) == 0 and len(com) == 0:
|
||||||
Dialogs.Err("Config - pyGTKtalog", "Error", "Extension and command required")
|
Dialogs.Err("Config - pyGTKtalog", "Error",
|
||||||
|
"Extension and command required")
|
||||||
return
|
return
|
||||||
|
|
||||||
if len(com) == 0:
|
if len(com) == 0:
|
||||||
@@ -172,7 +176,8 @@ class ConfigController(Controller):
|
|||||||
return
|
return
|
||||||
|
|
||||||
def on_ext_del_clicked(self, widget):
|
def on_ext_del_clicked(self, widget):
|
||||||
model, selection = self.view['extension_tree'].get_selection().get_selected_rows()
|
v = self.view['extension_tree']
|
||||||
|
model, selection = v.get_selection().get_selected_rows()
|
||||||
if len(selection) == 0:
|
if len(selection) == 0:
|
||||||
Dialogs.Err("Config - pyGTKtalog", "Error", "No item selected")
|
Dialogs.Err("Config - pyGTKtalog", "Error", "No item selected")
|
||||||
return
|
return
|
||||||
@@ -189,7 +194,8 @@ class ConfigController(Controller):
|
|||||||
return
|
return
|
||||||
|
|
||||||
for i in selection:
|
for i in selection:
|
||||||
self.model.confd['extensions'].pop(model.get_value(model.get_iter(i), 0))
|
m = self.model.confd['extensions']
|
||||||
|
m.pop(model.get_value(model.get_iter(i), 0))
|
||||||
|
|
||||||
self.__setup_extension_tree()
|
self.__setup_extension_tree()
|
||||||
return
|
return
|
||||||
@@ -237,20 +243,18 @@ class ConfigController(Controller):
|
|||||||
dialog = gtk.FileChooserDialog(
|
dialog = gtk.FileChooserDialog(
|
||||||
title=title,
|
title=title,
|
||||||
action=gtk.FILE_CHOOSER_ACTION_OPEN,
|
action=gtk.FILE_CHOOSER_ACTION_OPEN,
|
||||||
buttons=(
|
buttons=(gtk.STOCK_CANCEL,
|
||||||
gtk.STOCK_CANCEL,
|
|
||||||
gtk.RESPONSE_CANCEL,
|
gtk.RESPONSE_CANCEL,
|
||||||
gtk.STOCK_OPEN,
|
gtk.STOCK_OPEN,
|
||||||
gtk.RESPONSE_OK
|
gtk.RESPONSE_OK))
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
dialog.set_default_response(gtk.RESPONSE_OK)
|
dialog.set_default_response(gtk.RESPONSE_OK)
|
||||||
|
|
||||||
response = dialog.run()
|
response = dialog.run()
|
||||||
if response == gtk.RESPONSE_OK:
|
if response == gtk.RESPONSE_OK:
|
||||||
if __debug__:
|
if __debug__:
|
||||||
print "c_config.py: __show_filechooser()", dialog.get_filename()
|
print "c_config.py: __show_filechooser()",
|
||||||
|
print dialog.get_filename()
|
||||||
fn = dialog.get_filename()
|
fn = dialog.get_filename()
|
||||||
dialog.destroy()
|
dialog.destroy()
|
||||||
return fn
|
return fn
|
||||||
@@ -260,13 +264,10 @@ class ConfigController(Controller):
|
|||||||
dialog = gtk.FileChooserDialog(
|
dialog = gtk.FileChooserDialog(
|
||||||
title="Choose mount point",
|
title="Choose mount point",
|
||||||
action=gtk.FILE_CHOOSER_ACTION_OPEN,
|
action=gtk.FILE_CHOOSER_ACTION_OPEN,
|
||||||
buttons=(
|
buttons=(gtk.STOCK_CANCEL,
|
||||||
gtk.STOCK_CANCEL,
|
|
||||||
gtk.RESPONSE_CANCEL,
|
gtk.RESPONSE_CANCEL,
|
||||||
gtk.STOCK_OPEN,
|
gtk.STOCK_OPEN,
|
||||||
gtk.RESPONSE_OK
|
gtk.RESPONSE_OK))
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
dialog.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)
|
dialog.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)
|
||||||
dialog.set_filename(self.view['mnt_entry'].get_text())
|
dialog.set_filename(self.view['mnt_entry'].get_text())
|
||||||
|
|||||||
Reference in New Issue
Block a user