74 """ |
74 """ |
75 Private slot to initialize the actions. |
75 Private slot to initialize the actions. |
76 """ |
76 """ |
77 self.closeAct = \ |
77 self.closeAct = \ |
78 QAction(UI.PixmapCache.getIcon("close.png"), |
78 QAction(UI.PixmapCache.getIcon("close.png"), |
79 self.trUtf8("Close"), self) |
79 self.tr("Close"), self) |
80 self.closeAct.triggered[()].connect(self.close) |
80 self.closeAct.triggered.connect(self.close) |
81 |
81 |
82 self.openAct = \ |
82 self.openAct = \ |
83 QAction(UI.PixmapCache.getIcon("open.png"), |
83 QAction(UI.PixmapCache.getIcon("open.png"), |
84 self.trUtf8("Load"), self) |
84 self.tr("Load"), self) |
85 self.openAct.triggered[()].connect(self.load) |
85 self.openAct.triggered.connect(self.load) |
86 |
86 |
87 self.saveAct = \ |
87 self.saveAct = \ |
88 QAction(UI.PixmapCache.getIcon("fileSave.png"), |
88 QAction(UI.PixmapCache.getIcon("fileSave.png"), |
89 self.trUtf8("Save"), self) |
89 self.tr("Save"), self) |
90 self.saveAct.triggered[()].connect(self.__save) |
90 self.saveAct.triggered.connect(self.__save) |
91 |
91 |
92 self.saveAsAct = \ |
92 self.saveAsAct = \ |
93 QAction(UI.PixmapCache.getIcon("fileSaveAs.png"), |
93 QAction(UI.PixmapCache.getIcon("fileSaveAs.png"), |
94 self.trUtf8("Save As..."), self) |
94 self.tr("Save As..."), self) |
95 self.saveAsAct.triggered[()].connect(self.__saveAs) |
95 self.saveAsAct.triggered.connect(self.__saveAs) |
96 |
96 |
97 self.saveImageAct = \ |
97 self.saveImageAct = \ |
98 QAction(UI.PixmapCache.getIcon("fileSavePixmap.png"), |
98 QAction(UI.PixmapCache.getIcon("fileSavePixmap.png"), |
99 self.trUtf8("Save as Image"), self) |
99 self.tr("Save as Image"), self) |
100 self.saveImageAct.triggered[()].connect(self.umlView.saveImage) |
100 self.saveImageAct.triggered.connect(self.umlView.saveImage) |
101 |
101 |
102 self.printAct = \ |
102 self.printAct = \ |
103 QAction(UI.PixmapCache.getIcon("print.png"), |
103 QAction(UI.PixmapCache.getIcon("print.png"), |
104 self.trUtf8("Print"), self) |
104 self.tr("Print"), self) |
105 self.printAct.triggered[()].connect(self.umlView.printDiagram) |
105 self.printAct.triggered.connect(self.umlView.printDiagram) |
106 |
106 |
107 self.printPreviewAct = \ |
107 self.printPreviewAct = \ |
108 QAction(UI.PixmapCache.getIcon("printPreview.png"), |
108 QAction(UI.PixmapCache.getIcon("printPreview.png"), |
109 self.trUtf8("Print Preview"), self) |
109 self.tr("Print Preview"), self) |
110 self.printPreviewAct.triggered[()].connect( |
110 self.printPreviewAct.triggered.connect( |
111 self.umlView.printPreviewDiagram) |
111 self.umlView.printPreviewDiagram) |
112 |
112 |
113 def __initToolBars(self): |
113 def __initToolBars(self): |
114 """ |
114 """ |
115 Private slot to initialize the toolbars. |
115 Private slot to initialize the toolbars. |
116 """ |
116 """ |
117 self.windowToolBar = QToolBar(self.trUtf8("Window"), self) |
117 self.windowToolBar = QToolBar(self.tr("Window"), self) |
118 self.windowToolBar.setIconSize(UI.Config.ToolBarIconSize) |
118 self.windowToolBar.setIconSize(UI.Config.ToolBarIconSize) |
119 self.windowToolBar.addAction(self.closeAct) |
119 self.windowToolBar.addAction(self.closeAct) |
120 |
120 |
121 self.fileToolBar = QToolBar(self.trUtf8("File"), self) |
121 self.fileToolBar = QToolBar(self.tr("File"), self) |
122 self.fileToolBar.setIconSize(UI.Config.ToolBarIconSize) |
122 self.fileToolBar.setIconSize(UI.Config.ToolBarIconSize) |
123 self.fileToolBar.addAction(self.openAct) |
123 self.fileToolBar.addAction(self.openAct) |
124 self.fileToolBar.addSeparator() |
124 self.fileToolBar.addSeparator() |
125 self.fileToolBar.addAction(self.saveAct) |
125 self.fileToolBar.addAction(self.saveAct) |
126 self.fileToolBar.addAction(self.saveAsAct) |
126 self.fileToolBar.addAction(self.saveAsAct) |
208 """ |
208 """ |
209 Private slot to save the diagram with the current name. |
209 Private slot to save the diagram with the current name. |
210 """ |
210 """ |
211 self.__saveAs(self.__fileName) |
211 self.__saveAs(self.__fileName) |
212 |
212 |
|
213 @pyqtSlot() |
213 def __saveAs(self, filename=""): |
214 def __saveAs(self, filename=""): |
214 """ |
215 """ |
215 Private slot to save the diagram. |
216 Private slot to save the diagram. |
216 |
217 |
217 @param filename name of the file to write to (string) |
218 @param filename name of the file to write to (string) |
218 """ |
219 """ |
219 if not filename: |
220 if not filename: |
220 fname, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( |
221 fname, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( |
221 self, |
222 self, |
222 self.trUtf8("Save Diagram"), |
223 self.tr("Save Diagram"), |
223 "", |
224 "", |
224 self.trUtf8("Eric5 Graphics File (*.e5g);;All Files (*)"), |
225 self.tr("Eric5 Graphics File (*.e5g);;All Files (*)"), |
225 "", |
226 "", |
226 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) |
227 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) |
227 if not fname: |
228 if not fname: |
228 return |
229 return |
229 ext = QFileInfo(fname).suffix() |
230 ext = QFileInfo(fname).suffix() |
371 |
372 |
372 @param filename name of the file containing the invalid data (string) |
373 @param filename name of the file containing the invalid data (string) |
373 @param linenum number of the invalid line (integer) |
374 @param linenum number of the invalid line (integer) |
374 """ |
375 """ |
375 if linenum < 0: |
376 if linenum < 0: |
376 msg = self.trUtf8("""<p>The file <b>{0}</b> does not contain""" |
377 msg = self.tr("""<p>The file <b>{0}</b> does not contain""" |
377 """ valid data.</p>""").format(filename) |
378 """ valid data.</p>""").format(filename) |
378 else: |
379 else: |
379 msg = self.trUtf8("""<p>The file <b>{0}</b> does not contain""" |
380 msg = self.tr("""<p>The file <b>{0}</b> does not contain""" |
380 """ valid data.</p><p>Invalid line: {1}</p>""" |
381 """ valid data.</p><p>Invalid line: {1}</p>""" |
381 ).format(filename, linenum + 1) |
382 ).format(filename, linenum + 1) |
382 E5MessageBox.critical(self, self.trUtf8("Load Diagram"), msg) |
383 E5MessageBox.critical(self, self.tr("Load Diagram"), msg) |