I have this weird problem - I'm learning Gtk3 on Windows 7 with PyCharm Community 3.4.1. When I try to import Gtk:
from gi.repository import Gtk
it underlines Gtk as unresolved reference, becouse it's a binary module. Then I press Alt+Enter and choose "Generate methon stubs for binary module..." and wait until it it finishes indexing. Then I happily write this simple empty window with autocomplete working correctly:
class Okienko(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title='Okienko')
app = Okienko()
app.connect('delete-event', Gtk.main_quit)
app.show_all()
Gtk.main()
I run it, it shows me a nice empty Gtk window. So far so good.
BUT.
Bad things happen - autocomplete for Gtk module simply vanishes! from gi.repository import Gtk gets underlined red and autocomplete gives me just names which I've previously used (Window and main in this case). The only thing I can do is to Invalidate cache and restart Pycharm and go over this procedure again... I also tried .NET classes in IronPython - it's even worse, indexing takes several minutes and doesn't even finish.
In PyCharm community edition 3.4.1 (mint 17), to make Gtk3 autocompletion works:
In file: "pycharm.community-3.4.1/bin/idea.properties" comment the
line: "idea.max.intellisense.filesize=2500"
Restart the IDE
In your code: from gi.repository import Gtk strike Alt-Enter and select
"Generate stubs for binary module"
I had the same issue and found out that the Gtk.py file is too big for IDE file size limit allowed by PyCharm. I changed the config value "idea.max.intellisense.filesize" in idea.properties from 2500 to 10000. The stub generation takes some time but finishes now.
Hope that helps even Windows users. Feedback appreciated.
Related
I have a question. If there's any possibility to automatically import necessary classes when I work with Activities in text editor (gedit) or Netbeans? Because Android Studio is incredibly slow on my PC.
I mean import android.app.Activity import android.os.Bundle etc.
RTFM:
according to Netbeans doc:
There are several ways of how you can work with import statements. The IDE's Java Editor constantly checks your code for the correct use of import statements and immediately warns you when non-imported classes or unused import statements are detected.
When a non-imported class is found, the Bulb error icon error mark appears in the IDE's lefthand margin (this margin is also called the glyph margin). Click the error mark and choose whether to add the missing import or create this class in the current package.
While you are typing, press Ctrl-Shift-I (or choose Source > Fix Imports from the menu) to add all missing import statements at once.
Press Alt-Shift-I to add an import only for the type at which the cursor is located.
When you select a class from the code completion window, the Editor automatically adds an import statement for it, so you do not need to worry about this.
I am new to using IPython 4.0.0 and I am having a problem with tab completion.
At the moment, tab completion works for navigating through my directory structure, but it doesn't work for Python modules etc. If I import numpy and type:
numpy.[tab]
then nothing shows up.
So following the advice on this question: IPython tab completion not working, I installed readline and pyreadline, but it still didn't help. Then I added this code to my startup.py file:
try:
import readline
except ImportError:
print("Module readline not available.")
else:
import rlcompleter
readline.parse_and_bind("tab: complete")
Now when I type
numpy.[tab]
it shows me a list of attributes as I would expect. However, now I can't use tab complete to navigate around my directory structure, which is incredibly frustrating. It seems that IPython is meant to have this functionality built in, so can anyone suggest how I might get it working?
Cheers
I just moved a Python project into Eclipse, and I don't understand what this column (encircled in red) is trying to indicate to me:
I get that the blue rectangle is a sliding window that corresponds to the code section currently in the window, but what do the grey lines mean?
Other Information:
- I have used previous versions of Eclipse and PyDev and haven't seen this before. Even now, I only see it when I open a open a PyDev project. I assume it's some option associated with the PyDev perspective, but I can't find any option in the Customize Perspective menu for it.
- I have looked through several Eclipse tutorials and help files, and can't find any other examples of it.
- The grey lines don't seem to correspond to function calls, indentation, docstrings/comments, or any other code trait that I can think of.
- I am using Eclipse 4.3.1 (Kepler) with PyDev 1.0.0.9.
Note: The code shown is from the python-graph library. Copyright is held by the creators of that library.
For Java, in the editor of a class, I am used to hovering over an unknown class to bring up the quickfix menu which suggests imports to resolve the problem quickly.
Is there any such feature in the Scala IDE for eclipse? Hovering over an unknown class in a scala file does not bring up anything for me, so I end up typing imports manully. That is pretty annoying.
On a mac: CMD+shift+O adds imports as necessary and putting the cursor on a class name and doing CMD+1 does it for that one thing. Non-mac I'm sure has similar.
Simple Problem: Ever since I switched to Idea 10.5, it has this auto import feature enabled. For a Java developer, this is surely nice, but every time I type thing like var x: Float it automatically adds import java.lang.Float on the beginning of the file. Very often, it even adds imports I did not even want, from unknown packages deep in my jar jungle, and prefers Java over Scala packages.
Played around with the switches in Code completion tab, but it keeps on doing this. How can I get rid of this?
That is plugin bug. This should be fixed soon.
It's impossible to turn off in settings. Sorry for inconveniences.
In 2016.2.3 (Community Edition), this seems to have moved to the SBT pane:
Check "Code style" -> "Scala" -> "Imports" and "Editor" -> "Auto import" under Settings
On related note, to turn off auto import popup suggestion when the cursor is moved to line in intellij for mac:
Preferences -> Editor(Under IDE Settings) -> Auto Import -> Show Import Popup