10 from PyQt4.QtCore import * |
10 from PyQt4.QtCore import * |
11 from PyQt4.QtGui import * |
11 from PyQt4.QtGui import * |
12 |
12 |
13 from .Ui_FiletypeAssociationDialog import Ui_FiletypeAssociationDialog |
13 from .Ui_FiletypeAssociationDialog import Ui_FiletypeAssociationDialog |
14 |
14 |
|
15 |
15 class FiletypeAssociationDialog(QDialog, Ui_FiletypeAssociationDialog): |
16 class FiletypeAssociationDialog(QDialog, Ui_FiletypeAssociationDialog): |
16 """ |
17 """ |
17 Class implementing a dialog to enter filetype associations for the project. |
18 Class implementing a dialog to enter filetype associations for the project. |
18 """ |
19 """ |
19 def __init__(self, project, parent = None): |
20 def __init__(self, project, parent=None): |
20 """ |
21 """ |
21 Constructor |
22 Constructor |
22 |
23 |
23 @param project reference to the project object |
24 @param project reference to the project object |
24 @param parent reference to the parent widget (QWidget) |
25 @param parent reference to the parent widget (QWidget) |
29 self.filetypeAssociationList.headerItem().setText( |
30 self.filetypeAssociationList.headerItem().setText( |
30 self.filetypeAssociationList.columnCount(), "") |
31 self.filetypeAssociationList.columnCount(), "") |
31 self.filetypeAssociationList.header().setSortIndicator(0, Qt.AscendingOrder) |
32 self.filetypeAssociationList.header().setSortIndicator(0, Qt.AscendingOrder) |
32 |
33 |
33 # keep these lists in sync |
34 # keep these lists in sync |
34 self.filetypes = ["SOURCES", "FORMS", "TRANSLATIONS", "RESOURCES", "INTERFACES", |
35 self.filetypes = ["SOURCES", "FORMS", "TRANSLATIONS", "RESOURCES", "INTERFACES", |
35 "OTHERS", "__IGNORE__"] |
36 "OTHERS", "__IGNORE__"] |
36 self.filetypeStrings = [self.trUtf8("Sources"), self.trUtf8("Forms"), |
37 self.filetypeStrings = [self.trUtf8("Sources"), self.trUtf8("Forms"), |
37 self.trUtf8("Translations"), self.trUtf8("Resources"), |
38 self.trUtf8("Translations"), self.trUtf8("Resources"), |
38 self.trUtf8("Interfaces"), self.trUtf8("Others"), |
39 self.trUtf8("Interfaces"), self.trUtf8("Others"), |
39 self.trUtf8("Ignore")] |
40 self.trUtf8("Ignore")] |
40 self.filetypeCombo.addItems(self.filetypeStrings) |
41 self.filetypeCombo.addItems(self.filetypeStrings) |
41 |
42 |
42 self.project = project |
43 self.project = project |
43 for pattern, filetype in list(self.project.pdata["FILETYPES"].items()): |
44 for pattern, filetype in list(self.project.pdata["FILETYPES"].items()): |
52 |
53 |
53 def __resort(self): |
54 def __resort(self): |
54 """ |
55 """ |
55 Private method to resort the tree. |
56 Private method to resort the tree. |
56 """ |
57 """ |
57 self.filetypeAssociationList.sortItems(self.filetypeAssociationList.sortColumn(), |
58 self.filetypeAssociationList.sortItems(self.filetypeAssociationList.sortColumn(), |
58 self.filetypeAssociationList.header().sortIndicatorOrder()) |
59 self.filetypeAssociationList.header().sortIndicatorOrder()) |
59 |
60 |
60 def __reformat(self): |
61 def __reformat(self): |
61 """ |
62 """ |
62 Private method to reformat the tree. |
63 Private method to reformat the tree. |