~kokoto-java/kazam/depencie-and-stuff

« back to all changes in this revision

Viewing changes to kazam/frontend/save_dialog.py

  • Committer: David Klasinc
  • Date: 2012-11-11 19:36:05 UTC
  • mfrom: (193.2.82 unstable)
  • Revision ID: bigwhale@lubica.net-20121111193605-vh3fxglxwfhyh8ne
Merged from unstable branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
from gi.repository import Gtk
28
28
from gettext import gettext as _
29
 
 
 
29
from datetime import datetime
30
30
from kazam.backend.prefs import *
31
31
from kazam.backend.constants import *
32
32
 
37
37
                                   (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
38
38
                                   _("Save"), Gtk.ResponseType.OK))
39
39
 
 
40
 
 
41
    dt = datetime.today().strftime("%Y-%m-%d %H:%M:%S")
40
42
    if main_mode == MODE_SCREENCAST:
41
 
        dialog.set_current_name("{0}{1}".format(_("Untitled_Screencast"), CODEC_LIST[codec][3]))
 
43
        dialog.set_current_name("{0} {1}{2}".format(_("Screencast"), dt, CODEC_LIST[codec][3]))
42
44
    elif main_mode == MODE_SCREENSHOT:
43
 
        dialog.set_current_name(_("Untitled_Capture.png"))
 
45
        dialog.set_current_name("{0} {1}.png".format(_("Screenshot"), dt))
44
46
 
45
47
    dialog.set_do_overwrite_confirmation(True)
46
48
 
47
49
    if old_path and os.path.isdir(old_path):
48
50
            dialog.set_current_folder(old_path)
49
 
    elif os.path.isdir(prefs.video_dest):
50
 
        dialog.set_current_folder(prefs.video_dest)
 
51
    else:
 
52
        if main_mode == MODE_SCREENCAST:
 
53
            dialog.set_current_folder(prefs.video_dest)
 
54
        elif main_mode == MODE_SCREENSHOT:
 
55
            dialog.set_current_folder(prefs.picture_dest)
 
56
 
51
57
 
52
58
    dialog.show_all()
53
 
    #
54
 
    # In Oneiric Ocelot FileChooser dialog.run() will always report:
55
 
    # (kazam:4692): Gtk-WARNING **: Unable to retrieve the file info for...
56
 
    # This appears to be a bug in Gtk3 and it is fixed in Precise Pangolin.
57
 
    #
58
59
    result = dialog.run()
59
60
    old_path = dialog.get_current_folder()
60
61
    return dialog, result, old_path