mirror of
https://github.com/gryf/pygtktalog.git
synced 2025-12-17 19:40:21 +01:00
* Lots of changes, code cleanup, import/export in GUI.
This commit is contained in:
@@ -22,27 +22,26 @@
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
__version__ = "1.0 RC2"
|
||||
LICENCE = open('LICENCE').read()
|
||||
|
||||
import os.path
|
||||
from os import popen
|
||||
from utils import deviceHelper
|
||||
from gtkmvc import Controller
|
||||
|
||||
from c_config import ConfigController
|
||||
from views.v_config import ConfigView
|
||||
|
||||
from c_search import SearchController
|
||||
from views.v_search import SearchView
|
||||
|
||||
import views.v_dialogs as Dialogs
|
||||
|
||||
from views.v_image import ImageView
|
||||
|
||||
import gtk
|
||||
import pango
|
||||
|
||||
from gtkmvc import Controller
|
||||
|
||||
from lib import device_helper
|
||||
from lib.globs import APPL_VERSION
|
||||
from c_config import ConfigController
|
||||
from views.v_config import ConfigView
|
||||
from c_search import SearchController
|
||||
from views.v_search import SearchView
|
||||
import views.v_dialogs as Dialogs
|
||||
from views.v_image import ImageView
|
||||
|
||||
|
||||
|
||||
class MainController(Controller):
|
||||
"""Controller for main application window"""
|
||||
scan_cd = False
|
||||
@@ -526,9 +525,9 @@ class MainController(Controller):
|
||||
|
||||
def on_add_cd_activate(self, widget, label=None, current_id=None):
|
||||
"""Add directory structure from cd/dvd disc"""
|
||||
mount = deviceHelper.volmount(self.model.config.confd['cd'])
|
||||
mount = device_helper.volmount(self.model.config.confd['cd'])
|
||||
if mount == 'ok':
|
||||
guessed_label = deviceHelper.volname(self.model.config.confd['cd'])
|
||||
guessed_label = device_helper.volname(self.model.config.confd['cd'])
|
||||
if not label:
|
||||
label = Dialogs.InputDiskLabel(guessed_label).run()
|
||||
if label:
|
||||
@@ -541,7 +540,7 @@ class MainController(Controller):
|
||||
self.model.unsaved_project = True
|
||||
self.__set_title(filepath=self.model.filename, modified=True)
|
||||
else:
|
||||
deviceHelper.volumount(self.model.config.confd['cd'])
|
||||
device_helper.volumount(self.model.config.confd['cd'])
|
||||
return True
|
||||
else:
|
||||
Dialogs.Wrn("Error mounting device - pyGTKtalog",
|
||||
@@ -571,7 +570,7 @@ class MainController(Controller):
|
||||
# NOTE: about
|
||||
def on_about1_activate(self, widget):
|
||||
"""Show about dialog"""
|
||||
Dialogs.Abt("pyGTKtalog", __version__, "About",
|
||||
Dialogs.Abt("pyGTKtalog", "%d.%d.%d" % APPL_VERSION, "About",
|
||||
["Roman 'gryf' Dobosz"], LICENCE)
|
||||
return
|
||||
|
||||
@@ -870,6 +869,16 @@ class MainController(Controller):
|
||||
def on_expand_all1_activate(self, menu_item):
|
||||
self.view['discs'].expand_all()
|
||||
return
|
||||
|
||||
def on_export_activate(self, menu_item):
|
||||
"""export db file and coressponding images to tar.bz2 archive"""
|
||||
dialog = Dialogs.ChooseFilename(None, "Choose export file")
|
||||
filepath = dialog.run()
|
||||
|
||||
if not filepath:
|
||||
return
|
||||
|
||||
# TODO: dokończyć ten shit
|
||||
|
||||
def on_collapse_all1_activate(self, menu_item):
|
||||
self.view['discs'].collapse_all()
|
||||
@@ -1354,7 +1363,7 @@ class MainController(Controller):
|
||||
# umount/eject cd
|
||||
ejectapp = self.model.config.confd['ejectapp']
|
||||
if self.model.config.confd['eject'] and ejectapp:
|
||||
msg = deviceHelper.eject_cd(ejectapp,
|
||||
msg = device_helper.eject_cd(ejectapp,
|
||||
self.model.config.confd['cd'])
|
||||
if msg != 'ok':
|
||||
Dialogs.Wrn("error ejecting device - pyGTKtalog",
|
||||
@@ -1362,7 +1371,7 @@ class MainController(Controller):
|
||||
self.model.config.confd['cd'],
|
||||
"Last eject message:\n%s" % msg)
|
||||
else:
|
||||
msg = deviceHelper.volumount(self.model.config.confd['cd'])
|
||||
msg = device_helper.volumount(self.model.config.confd['cd'])
|
||||
if msg != 'ok':
|
||||
Dialogs.Wrn("error unmounting device - pyGTKtalog",
|
||||
"Cannot unmount device pointed to %s" %
|
||||
|
||||
Reference in New Issue
Block a user