Plugins/ViewManagerPlugins/Listspace/Listspace.py

changeset 3190
a9a94491c4fd
parent 3160
209a07d7e401
child 3201
0f115f6db6cb
equal deleted inserted replaced
3189:9a21c547de5f 3190:a9a94491c4fd
225 Private method to initialize the viewlist context menu. 225 Private method to initialize the viewlist context menu.
226 """ 226 """
227 self.__menu = QMenu(self) 227 self.__menu = QMenu(self)
228 self.__menu.addAction( 228 self.__menu.addAction(
229 UI.PixmapCache.getIcon("tabClose.png"), 229 UI.PixmapCache.getIcon("tabClose.png"),
230 self.trUtf8('Close'), self.__contextMenuClose) 230 self.tr('Close'), self.__contextMenuClose)
231 self.closeOthersMenuAct = self.__menu.addAction( 231 self.closeOthersMenuAct = self.__menu.addAction(
232 UI.PixmapCache.getIcon("tabCloseOther.png"), 232 UI.PixmapCache.getIcon("tabCloseOther.png"),
233 self.trUtf8("Close Others"), 233 self.tr("Close Others"),
234 self.__contextMenuCloseOthers) 234 self.__contextMenuCloseOthers)
235 self.__menu.addAction( 235 self.__menu.addAction(
236 self.trUtf8('Close All'), self.__contextMenuCloseAll) 236 self.tr('Close All'), self.__contextMenuCloseAll)
237 self.__menu.addSeparator() 237 self.__menu.addSeparator()
238 self.saveMenuAct = self.__menu.addAction( 238 self.saveMenuAct = self.__menu.addAction(
239 UI.PixmapCache.getIcon("fileSave.png"), 239 UI.PixmapCache.getIcon("fileSave.png"),
240 self.trUtf8('Save'), self.__contextMenuSave) 240 self.tr('Save'), self.__contextMenuSave)
241 self.__menu.addAction( 241 self.__menu.addAction(
242 UI.PixmapCache.getIcon("fileSaveAs.png"), 242 UI.PixmapCache.getIcon("fileSaveAs.png"),
243 self.trUtf8('Save As...'), self.__contextMenuSaveAs) 243 self.tr('Save As...'), self.__contextMenuSaveAs)
244 self.__menu.addAction( 244 self.__menu.addAction(
245 UI.PixmapCache.getIcon("fileSaveAll.png"), 245 UI.PixmapCache.getIcon("fileSaveAll.png"),
246 self.trUtf8('Save All'), self.__contextMenuSaveAll) 246 self.tr('Save All'), self.__contextMenuSaveAll)
247 self.__menu.addSeparator() 247 self.__menu.addSeparator()
248 self.openRejectionsMenuAct = self.__menu.addAction( 248 self.openRejectionsMenuAct = self.__menu.addAction(
249 self.trUtf8("Open 'rejection' file"), 249 self.tr("Open 'rejection' file"),
250 self.__contextMenuOpenRejections) 250 self.__contextMenuOpenRejections)
251 self.__menu.addSeparator() 251 self.__menu.addSeparator()
252 self.__menu.addAction( 252 self.__menu.addAction(
253 UI.PixmapCache.getIcon("print.png"), 253 UI.PixmapCache.getIcon("print.png"),
254 self.trUtf8('Print'), self.__contextMenuPrintFile) 254 self.tr('Print'), self.__contextMenuPrintFile)
255 self.__menu.addSeparator() 255 self.__menu.addSeparator()
256 self.copyPathAct = self.__menu.addAction( 256 self.copyPathAct = self.__menu.addAction(
257 self.trUtf8("Copy Path to Clipboard"), 257 self.tr("Copy Path to Clipboard"),
258 self.__contextMenuCopyPathToClipboard) 258 self.__contextMenuCopyPathToClipboard)
259 259
260 def __showMenu(self, point): 260 def __showMenu(self, point):
261 """ 261 """
262 Private slot to handle the customContextMenuRequested signal of 262 Private slot to handle the customContextMenuRequested signal of
382 """ 382 """
383 editor = win.getEditor() 383 editor = win.getEditor()
384 if fn is None: 384 if fn is None:
385 if not noName: 385 if not noName:
386 self.untitledCount += 1 386 self.untitledCount += 1
387 noName = self.trUtf8("Untitled {0}").format(self.untitledCount) 387 noName = self.tr("Untitled {0}").format(self.untitledCount)
388 self.viewlist.addItem(noName) 388 self.viewlist.addItem(noName)
389 editor.setNoName(noName) 389 editor.setNoName(noName)
390 else: 390 else:
391 txt = os.path.basename(fn) 391 txt = os.path.basename(fn)
392 if not QFileInfo(fn).isWritable(): 392 if not QFileInfo(fn).isWritable():
393 txt = self.trUtf8("{0} (ro)").format(txt) 393 txt = self.tr("{0} (ro)").format(txt)
394 itm = QListWidgetItem(txt) 394 itm = QListWidgetItem(txt)
395 itm.setToolTip(fn) 395 itm.setToolTip(fn)
396 self.viewlist.addItem(itm) 396 self.viewlist.addItem(itm)
397 self.currentStack.addWidget(win) 397 self.currentStack.addWidget(win)
398 self.currentStack.setCurrentWidget(win) 398 self.currentStack.setCurrentWidget(win)
503 if newName: 503 if newName:
504 currentRow = self.viewlist.currentRow() 504 currentRow = self.viewlist.currentRow()
505 index = self.editors.index(editor) 505 index = self.editors.index(editor)
506 txt = os.path.basename(newName) 506 txt = os.path.basename(newName)
507 if not QFileInfo(newName).isWritable(): 507 if not QFileInfo(newName).isWritable():
508 txt = self.trUtf8("{0} (ro)").format(txt) 508 txt = self.tr("{0} (ro)").format(txt)
509 itm = self.viewlist.item(index) 509 itm = self.viewlist.item(index)
510 itm.setText(txt) 510 itm.setText(txt)
511 itm.setToolTip(newName) 511 itm.setToolTip(newName)
512 self.viewlist.setCurrentRow(currentRow) 512 self.viewlist.setCurrentRow(currentRow)
513 self.changeCaption.emit(newName) 513 self.changeCaption.emit(newName)

eric ide

mercurial