Setting different code styles for separate projects in Pycharm - python

I'm using Pycharm, and it's a great editor, but I have this issue while working on a number of projects at the same time. Unfortunately, the different projects I'm working on have different code styles.
The easiest example is that one uses spaces, while another uses tabs.
While I don't want to go into the whole Tabs vs Spaces debate, I'm wondering if there is a way to set Pycharm to use separate coding style rules per projects.
Thanks

Pycharm's Code Style configuration has built-in scheme setting just for your requirement.
Preference -> Editor -> Code Style -> Python
After setting the style, you can store it with the project, by clicking the Scheme pull-down menu list. Also you can store/export the style by clicking the gear icon next to it.

After reading the halfelf's answer, I found this option:
File -> Settings -> Editor -> Code Style -> Python
In the scheme options, there is a drop down list where you can choose project and set the choices to the relevant project only (the one that is currently chosen.
Hope this helps..

Related

Editing text in PyCharm

I've started using PyCharm 2 this year and it's working well for me, the only thing is that when I add comments in, it all sort of gets lost in the amounts of code.
Is there a way to add any text formatting to only certain parts of my programs? Like increasing the font of the comments that separate different practice questions, or even just bolding some of my comments to make the sections stand out more?
I know you can change the text for the entire file, but I want some diversity so it's a bit easier for other people (and sometimes myself) to read.
Go to Preferences->Editing->Color Scheme. From there you can change the way all the different types of program elements are displayed. You can use colors, bold, and italic to highlight things differently. I don't think you can assign different fonts or sizes, though.
Go to File -> Settings -> Editor -> Color scheme
Comments are under "Language Defaults"

Python GTK3 Basic Text Editor Like MS Office, LibreOffice

I want to create text editor that have coloring feature, Bold,Italic, ... and too many basically Office Program feature for users of my program. but creating this will take too much of my time. so is there a module, package or code for this ?
Thanks.
Gtk3 already has Gtk.TextView and Gtk.TextBuffer which has the requirements you mention (though might be missing some of the more sophisticated ones of a real Office suite). It can also insert images, and do many other tricks. Of course, you have to provide the commands to do steer the widget into executing each of them.
Another possibility is using a web-based editor, and include webkit in your project.

Multiple right margins in Pycharm

I am learning Pycharm Community Edition 3.4 and I was wondering If it was possible to have a right a margin for comments and docstring only, additionally to the regular margin for the rest of the code.
I ask because I am trying to stick to the PEP8 guideline of 72 characters per comment and 79 for regular code. I am constantly changing the right margin between 72/79 to make sure everything is fine but I don't find that very efficient.
Thanks in advance.
This feature was announced in September 2017.
Go to File -> Settings -> Editor -> Code Style -> Hard wrap at and Visual guides. For visual guides, you can enter multiple values separated by commas.
It is not possible in Pycharm given its basic configuration (without some plugins). But I am afraid that even plugins for this feature does not exist for Pycharm. At least, I could not find it.
In this question you may probably find something helpful:
https://superuser.com/questions/703425/intellij-ide-how-to-add-one-or-more-margins.
This is not yet a feature of any of the Intellij platforms.
You can follow/vote for the ticket here https://youtrack.jetbrains.com/issue/IDEA-99875

Python program written in Notepad++, error in TextWrangler

So I wrote a program in python using NotePad++ in Windows, but then when I opened the file in Mac computer using TextWrangler or any text editor in it and after compiling it, there was an error message regarding indentation. How can I easily fix this?
Here is something to do with your file via Notepad++:
Edit -> Blank Operations -> TAB to Space
If this won't help (and most likely it won't) you will need to check indents manually. I can suggest View -> Show Symbol -> Show Indent Guide for convenience.
It is a good and safe style to use only spaces. Not to face this problem in your future projects configure Notepad++: Settings -> Tab Settings -> Replace by space. You will still be able to use tabs, but they will be changed to defined number of spaces (4 for me). Hope this helps.

Working with different projects in eclipse

I program in conjunction Eclipse(4 javascript) & PyDev.
For example in one project, I opened 5 tabs with different files. Now I need to work with another project, but I do not want to then return to the previous draft to look over all the necessary files and open them again, with close existing ones. How easy is it to switch to a different project to see if there was something open, so it stays?
What I understand is, that you want to stay focused on the work you are doing at the moment. And you have different contexts you want to switch between. There are at least three options to go with:
Use different workspaces (with the same Eclipse installation). This is useful if there is no overlap between the 2, so each workspace represents a different kind of work and context to do.
To do that, define 2 workspaces, and a shortcut or shell file to start the 2 eclipse instances for them. In windows these 2 may look:
start-ecl1: c:\eclipse\eclipse.exe -vm <jdk> -data ws1
start-ecl2: c:\eclipse\eclipse.exe -vm <jdk> -data ws2
Use different windows inside the same workspace. So you share the same directory (== workspace), but divide your work be the physikcal window. You have only one Eclipse running, but are able to switch between the 2 contexts by switching between the windows.
To do that, select from the e.g. package explorer view the menu entry Open in new window.
As a variation of this, you can use instead different working sets for different contexts. For doing that, do the following steps:
In the package explorer, open the "Select Working Set" dialog.
Create there a new working set, and define which projects should be visible in that working set.
Give it a name, and select the working set then.
As a result, only the projects you have selected are visible in the package explorer.
However, the editors that are open from not visible projects are kept open, so this goes not as far as the next option, using Mylyn.
Use Mylyn and tasks to define the task at hand. The context will be built by Mylyn on the fly, and when you switch the tasks, Mylyn will switch the context (open editors, views, ...) for you.
To get started with Mylyn, have a look at the videos at Mylyn get started
My personal opinion is that the last one is the most elaborate, the first one is good if the projects have nothing to do with each other. The second one is easiest to use.
Mylyn is what you are looking for. If you search the internet there's a lot of tutorials available.
One of my favorite is http://www.vogella.de/articles/Mylyn/article.html
Its basically an eclipse plug-in installed by default to some eclipse packages. If you dont have one you can install using this update site http://download.eclipse.org/mylyn/releases/latest
Hope it helps :)

Categories

Resources