Tizen 2.1 base
[platform/upstream/hplip.git] / ui4 / mimetypesdialog.py
1 # -*- coding: utf-8 -*-
2 #
3 # (c) Copyright 2001-2008 Hewlett-Packard Development Company, L.P.
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
18 #
19 # Author: Don Welch
20 #
21
22 # Local
23 from base.g import *
24 from base.codes import *
25 from ui_utils import *
26
27 # Qt
28 from PyQt4.QtCore import *
29 from PyQt4.QtGui import *
30 from mimetypesdialog_base import Ui_MimeTypesDialog_base
31
32
33
34 class MimeTypesDialog(QDialog, Ui_MimeTypesDialog_base):
35     def __init__(self, mime_types, parent=None):
36         QDialog.__init__(self, parent)
37         self.setupUi(self)
38
39         self.TypesTableWidget.setRowCount(len(mime_types))
40         t = mime_types.keys()
41         t.sort()
42         for row, m in enumerate(t):
43             i = QTableWidgetItem(m)
44             self.TypesTableWidget.setItem(row, 0, i)
45
46             i = QTableWidgetItem(mime_types[m][0])
47             self.TypesTableWidget.setItem(row, 1, i)
48
49             i = QTableWidgetItem(mime_types[m][1])
50             self.TypesTableWidget.setItem(row, 2, i)
51
52         self.TypesTableWidget.resizeColumnsToContents()
53
54
55     def __tr(self,s,c = None):
56         return qApp.translate("SettingsDialog",s,c)
57
58