~ubuntu-branches/ubuntu/saucy/unity-tweak-tool/saucy-proposed

« back to all changes in this revision

Viewing changes to UnityTweakTool/elements/filechooser.py

  • Committer: Package Import Robot
  • Author(s): Barneedhar Vigneshwar
  • Date: 2013-02-15 20:33:41 UTC
  • Revision ID: package-import@ubuntu.com-20130215203341-yqrfr9df488k41am
Tags: 0.0.3
* New upstream release
* Closes needs-packaging bug (LP: #1126433)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python3
 
2
# -*- coding: utf-8 -*-
 
3
#
 
4
# Team:
 
5
#   J Phani Mahesh <phanimahesh@gmail.com>
 
6
#   Barneedhar (jokerdino) <barneedhar@ubuntu.com>
 
7
#   Amith KK <amithkumaran@gmail.com>
 
8
#   Georgi Karavasilev <motorslav@gmail.com>
 
9
#   Sam Tran <samvtran@gmail.com>
 
10
#   Sam Hewitt <hewittsamuel@gmail.com>
 
11
#   Angel Araya <al.arayaq@gmail.com>
 
12
#
 
13
# Description:
 
14
#   A One-stop configuration tool for Unity.
 
15
#
 
16
# Legal Stuff:
 
17
#
 
18
# This file is a part of Unity Tweak Tool
 
19
#
 
20
# Unity Tweak Tool is free software; you can redistribute it and/or modify it under
 
21
# the terms of the GNU General Public License as published by the Free Software
 
22
# Foundation; version 3.
 
23
#
 
24
# Unity Tweak Tool is distributed in the hope that it will be useful, but WITHOUT
 
25
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
26
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 
27
# details.
 
28
#
 
29
# You should have received a copy of the GNU General Public License along with
 
30
# this program; if not, see <https://www.gnu.org/licenses/gpl-3.0.txt>
 
31
 
 
32
''' Definitions for FileChooser element. '''
 
33
import UnityTweakTool.config.data as data
 
34
from gi.repository import Gtk
 
35
import os
 
36
 
 
37
import logging
 
38
logger=logging.getLogger('UnityTweakTool.elements.filechooser')
 
39
 
 
40
class FileChooser:
 
41
    def __init__(self,controlObj):
 
42
        ''' Initialise a FileChooser element from a dictionary'''
 
43
        self.builder = Gtk.Builder()
 
44
        self.ui = os.path.join(data.get_data_path(),'filechooser-theme.ui')
 
45
        self.builder.add_from_file(self.ui)
 
46
        self.widget=self.builder.get_object('themeselector')
 
47
        self.builder.connect_signals(self)
 
48
    def run(self):
 
49
        self.widget.run()
 
50
    def on_button_cancel_clicked(self,*args,**kwargs):
 
51
        logger.info('Theme selection cancelled by user')
 
52
        self.widget.destroy()
 
53
    def on_button_install_clicked(self,*args,**kwargs):
 
54
        logger.debug('Install clicked')
 
55
        file=self.widget.get_filename()
 
56
        if file is None:
 
57
            return
 
58
        logger.info('Attempting to install %s'%file)
 
59
        logger.warn('Unimplemented logic')
 
60
        # TODO : Get file name and do the installation
 
61
        self.widget.destroy()
 
62