Plugins/ViewManagerPlugins/Tabview/Tabview.py

changeset 53
c3eb7cc1ff8b
parent 15
f6ccc31d6e72
child 55
b5c84934de9c
equal deleted inserted replaced
52:ba69827929ee 53:c3eb7cc1ff8b
10 import os 10 import os
11 11
12 from PyQt4.QtCore import * 12 from PyQt4.QtCore import *
13 from PyQt4.QtGui import * 13 from PyQt4.QtGui import *
14 14
15 from E4Gui.E4Application import e4App 15 from E4Gui.E4Application import e5App
16 16
17 from ViewManager.ViewManager import ViewManager 17 from ViewManager.ViewManager import ViewManager
18 18
19 import QScintilla.Editor 19 import QScintilla.Editor
20 20
261 """ 261 """
262 if self.editors: 262 if self.editors:
263 self.contextMenuEditor = self.widget(index) 263 self.contextMenuEditor = self.widget(index)
264 if self.contextMenuEditor: 264 if self.contextMenuEditor:
265 self.saveMenuAct.setEnabled(self.contextMenuEditor.isModified()) 265 self.saveMenuAct.setEnabled(self.contextMenuEditor.isModified())
266 self.projectMenuAct.setEnabled(e4App().getObject("Project").isOpen()) 266 self.projectMenuAct.setEnabled(e5App().getObject("Project").isOpen())
267 267
268 self.contextMenuIndex = index 268 self.contextMenuIndex = index
269 self.leftMenuAct.setEnabled(index > 0) 269 self.leftMenuAct.setEnabled(index > 0)
270 self.rightMenuAct.setEnabled(index < self.count() - 1) 270 self.rightMenuAct.setEnabled(index < self.count() - 1)
271 self.firstMenuAct.setEnabled(index > 0) 271 self.firstMenuAct.setEnabled(index > 0)
372 if fn: 372 if fn:
373 if Preferences.getUI("TabViewManagerFilenameOnly"): 373 if Preferences.getUI("TabViewManagerFilenameOnly"):
374 txt = os.path.basename(fn) 374 txt = os.path.basename(fn)
375 else: 375 else:
376 txt = fn 376 txt = fn
377 ppath = e4App().getObject("Project").getProjectPath() 377 ppath = e5App().getObject("Project").getProjectPath()
378 if ppath: 378 if ppath:
379 txt = txt.replace(ppath + os.sep, "") 379 txt = txt.replace(ppath + os.sep, "")
380 380
381 maxFileNameChars = Preferences.getUI("TabViewManagerFilenameLength") 381 maxFileNameChars = Preferences.getUI("TabViewManagerFilenameLength")
382 if len(txt) > maxFileNameChars: 382 if len(txt) > maxFileNameChars:
733 else: 733 else:
734 if self.filenameOnly: 734 if self.filenameOnly:
735 txt = os.path.basename(fn) 735 txt = os.path.basename(fn)
736 else: 736 else:
737 txt = fn 737 txt = fn
738 ppath = e4App().getObject("Project").getProjectPath() 738 ppath = e5App().getObject("Project").getProjectPath()
739 if ppath: 739 if ppath:
740 txt = txt.replace(ppath + os.sep, "") 740 txt = txt.replace(ppath + os.sep, "")
741 if len(txt) > self.maxFileNameChars: 741 if len(txt) > self.maxFileNameChars:
742 txt = "...%s" % txt[-self.maxFileNameChars:] 742 txt = "...%s" % txt[-self.maxFileNameChars:]
743 if not QFileInfo(fn).isWritable(): 743 if not QFileInfo(fn).isWritable():
773 else: 773 else:
774 if self.filenameOnly: 774 if self.filenameOnly:
775 txt = os.path.basename(fn) 775 txt = os.path.basename(fn)
776 else: 776 else:
777 txt = fn 777 txt = fn
778 ppath = e4App().getObject("Project").getProjectPath() 778 ppath = e5App().getObject("Project").getProjectPath()
779 if ppath: 779 if ppath:
780 txt = txt.replace(ppath + os.sep, "") 780 txt = txt.replace(ppath + os.sep, "")
781 if len(txt) > self.maxFileNameChars: 781 if len(txt) > self.maxFileNameChars:
782 txt = "...%s" % txt[-self.maxFileNameChars:] 782 txt = "...%s" % txt[-self.maxFileNameChars:]
783 if not QFileInfo(fn).isWritable(): 783 if not QFileInfo(fn).isWritable():
844 """ 844 """
845 if self.filenameOnly: 845 if self.filenameOnly:
846 tabName = os.path.basename(newName) 846 tabName = os.path.basename(newName)
847 else: 847 else:
848 tabName = newName 848 tabName = newName
849 ppath = e4App().getObject("Project").getProjectPath() 849 ppath = e5App().getObject("Project").getProjectPath()
850 if ppath: 850 if ppath:
851 tabName = tabName.replace(ppath + os.sep, "") 851 tabName = tabName.replace(ppath + os.sep, "")
852 if len(tabName) > self.maxFileNameChars: 852 if len(tabName) > self.maxFileNameChars:
853 tabName = "...%s" % tabName[-self.maxFileNameChars:] 853 tabName = "...%s" % tabName[-self.maxFileNameChars:]
854 index = self.currentTabWidget.indexOf(editor) 854 index = self.currentTabWidget.indexOf(editor)
1074 if fn: 1074 if fn:
1075 if self.filenameOnly: 1075 if self.filenameOnly:
1076 txt = os.path.basename(fn) 1076 txt = os.path.basename(fn)
1077 else: 1077 else:
1078 txt = fn 1078 txt = fn
1079 ppath = e4App().getObject("Project").getProjectPath() 1079 ppath = e5App().getObject("Project").getProjectPath()
1080 if ppath: 1080 if ppath:
1081 txt = txt.replace(ppath + os.sep, "") 1081 txt = txt.replace(ppath + os.sep, "")
1082 if len(txt) > self.maxFileNameChars: 1082 if len(txt) > self.maxFileNameChars:
1083 txt = "...%s" % txt[-self.maxFileNameChars:] 1083 txt = "...%s" % txt[-self.maxFileNameChars:]
1084 if not QFileInfo(fn).isWritable(): 1084 if not QFileInfo(fn).isWritable():

eric ide

mercurial