Repository: spyder-ide/spyder

Issue:
Display file path of file in the Editor title again
The latest version of Spyder no longer shows the file path of the file currently displayed in the editor.

In past versions of Spyder, the file path was displayed here.

![image](https://cloud.githubusercontent.com/assets/20540949/23872826/63533948-07f5-11e7-95ab-ec1858f3ac66.png)



Please replace this feature. It is extremely useful.



Python 3.5.2 
Spyder 3.1.3
QT 5.6.2
PyQT5 5.6 on Windows 10

jedi =0.9.0      :  0.9.0 (OK)
matplotlib >=1.0 :  2.0.0 (OK)
nbconvert >=4.0  :  5.1.1 (OK)
numpy >=1.7      :  1.11.3 (OK)
pandas >=0.13.1  :  0.19.2 (OK)
pep8 >=0.6       :  1.7.0 (OK)
pyflakes >=0.6.0 :  1.5.0 (OK)
pygments >=2.0   :  2.2.0 (OK)
pylint >=0.25    :  1.6.4 (OK)
qtconsole >=4.2.0:  4.2.1 (OK)
rope >=0.9.4     :  0.9.4-1 (OK)
sphinx >=0.6.6   :  1.5.3 (OK)
sympy >=0.7.3    :  1.0 (OK)



Discussion:
That's because we're working on a Jupyter notebook plugin which is going to be tabbed next to the Editor, and the file's full path name made the Editor's tab way too long.

To see the file's path now you need to place the cursor over its tab, like this

![seleccion_001](https://cloud.githubusercontent.com/assets/365293/23908928/5b34b648-08a3-11e7-8004-77f05fefc707.png)
That makes sense. I still like being able to see the path without moving my mouse, but I can live with this.

Thanks for all the work you're doing by the way. I really like Spyder. 
Thanks for understanding :-)
This doesn't make sense to me.  Are we concerned about the widths of the individual file tabs, or the overall width of the Editor pane?  I understand that putting the full file path on each tab makes them too long, but putting the full file path next to 'Editor' doesn't seem like it would affect much of anything.  Generally, the file's path is narrower than my Editor pane.  What am I missing?

I would classify this as a significant usability regression.
@joshburnett, right now there are no problems in reverting to the old state of things. *But* if we want to tab other plugins next to the Editor then you'll see something like this:

![seleccion_001](https://cloud.githubusercontent.com/assets/365293/24015622/09214faa-0a57-11e7-990d-253e1f289061.png)

and we want to avoid this because we want our notebook plugin to be tabbed next to the Editor.

----

@goanpeca, is there a way to make the filename appear on the plugin title but not on its tab?
I think we can work something out when tabs are on top
Mmmhh, but that's for Spyder 4. What about right now?
I agree we don't want a floating tab on the right side of a file name (the tab will be in a different position for every file path), but is it possible to put the tab permanently on the far right side of the "editor" bar? Or even put the tab on the left of the editor path? 

As long as the position of the tab is static, I don't think people will get have a problem with it being on one side or the other. 
@dhendricks-medic, I don't understand your suggestion. Could post a screenshot/mockup of it?
Part of this could be a misunderstanding on my part about what you're trying to do with the tab. If there are only one or two tabs, then you could put them on the editor bar in such a way that the editor bar still has a lot of space. But if you're going to be adding lots of tabs, then this doesn't work. 

![image](https://cloud.githubusercontent.com/assets/20540949/24016680/bc070862-0a52-11e7-9b1c-fc805a1f6308.png)

Ah, I see the implications now, with the other tabs there. That didn't even occur to me that it could be the issue, as I tend to put my editor pane in its own spot and not share the spot with any other tabs.

I'd be fine with just having the file path show up when there is room, such as when the editor is not a tab.

I do frequently edit many files with similar names (not always at the same time), and it's really nice to be able to just glance at the file path next to the editor tab to determine exactly which file I'm editing. I can see that it wouldn't matter as much when using the mouse to select file tabs in the editor, as the user is already mousing over the tabs. However, if the user is navigating between tabs via the keyboard (as I usually do), this basically forces them to switch to mousing to get that same info.

Josh

On Mar 16, 2017, 4:13 PM -0400, dhendricks-medic <notifications@github.com>, wrote:
>
> Part of this could be a misunderstanding on my part about what you're trying to do with the tab. If there are only one or two tabs, then you could put them on the editor bar in such a way that the editor bar still has a lot of space. But if you're going to be adding lots of tabs, then this doesn't work.
>
>
>
>
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub (https://github.com/spyder-ide/spyder/issues/4259#issuecomment-287177471), or mute the thread (https://github.com/notifications/unsubscribe-auth/AMX25zRUId82EgXdxZ_CHlLzbphpeZg9ks5rmZf5gaJpZM4Mcq4w).
>
>
>


Having files with similar names is the primary reason I started this thread. The file path was very important for me to know which one I was currently viewing. 
But we added disambiguation to the Editor tabs in 3.1.0. Isn't that enough for you guys?
The disambiguation is indeed very helpful, and I was pleasantly surprised when it showed up for the first time.  Unfortunately, it only shows up when I have multiple files with the same name open simultaneously.  If I only have one of them open (and I'm frequently opening and closing them), I sometimes need to check the path to verify which one I'm in at that point.

In my workflow, I'm analyzing data from various sets of experiments.  I tend to group the data file from a single experiment in a folder, with similar (but not identical) processing scripts in each directory.  The directory name is the identifier for the experiment, not the script name.  As such, I end up with a folder structure like this:

experiment A/analysis_type1.py
experiment A/analysis_type2.py
experiment A/analysis_type3.py
experiment B/analysis_type1.py
experiment B/analysis_type2.py

The experiment names can get much longer than simply 'experiment A,' obviously, so it's not super helpful to include that info in the script name itself.  The file's path is very helpful to be able to glance at.

As an aside, I really like spyder a lot and use (and promote) it heavily at work.  Thank you for the continued hard work on it.
Thanks @joshburnett for your kind words, and for your explanation.

I think we can implement the compromise you proposed, i.e. show (as before) the full path of files in the Editor title if there's no other plugin tabbed next to the Editor, and hide it if there is one.

@dhendricks-medic, is that ok for you too?
That depends on in which circumstances the plugin tabs will appear. If the plugin tabs only "disappear" when the editor has been popped into a separate window, then nothing will change for me because I don't pop the editor out. If the plugin tabs are optional on the main spyder window, then yes, this would work for me because i just won't add any of the optional tabs.

If the plugin tabs are not optional on the main spyder window, then I would prefer some other solution where its possible to display the full path length at all times. 

That said, I had already resigned myself to using the mouse more often, but if its possible to get away from that, then I would prefer that solution. Even using the hot key "ctr-P" to switch between editor files only displays a partial path for each file (which is often enough to differentiate between files, but not always), and so the full path would be appreciated. 

Thanks for working on this. I think meeting Joshburnett's needs are probably higher priority than mine. I can live with the way things currently are (though I'd prefer them otherwise), but it sounds like he can't. 
What about showing complete file path in the window title? (some editors do that)
@rlaverde, the path can be quite large and so we'd need to decide how to shorten it.
/some/very/very/very/very/very/very/very/very/very/very/long/path.py

remove from middle or middle minus one to the left excluding file_name:
/some/very/very/very/.../very/very/very/long/path.py
/some/very/very/.../very/very/long/path.py
/some/very/.../very/long/path.py

...

/some/.../long/path.py
/.../long/path.py

until a max of:

/.../path.py

and eventyally only

path.py
@dalthviz, we need to detect when the Editor is tabbed and only then remove the file path from its title.

Resolving patch:
diff --git a/spyder/plugins/editor.py b/spyder/plugins/editor.py
--- a/spyder/plugins/editor.py
+++ b/spyder/plugins/editor.py
@@ -551,6 +551,13 @@ def restore_scrollbar_position(self):
     def get_plugin_title(self):
         """Return widget title"""
         title = _('Editor')
+        if self.dockwidget:
+            filename = self.get_current_filename()
+            if self.dockwidget.dock_tabbar:
+                if filename and self.dockwidget.dock_tabbar.count() < 2:
+                    title += ' - ' + to_text_string(filename)
+            else:
+                 title += ' - ' + to_text_string(filename)
         return title
 
     def get_plugin_icon(self):
@@ -574,6 +581,7 @@ def visibility_changed(self, enable):
             self.dock_toolbar.hide()
         if enable:
             self.refresh_plugin()
+        self.update_plugin_title.emit()
     
     def refresh_plugin(self):
         """Refresh editor plugin"""


Test patch: