Suggestions & Ideas

Dan Dediu
2010-06-19
2014-08-12
1 2 3 > >> (Page 1 of 3)
  • Dan Dediu
    Dan Dediu
    2010-06-19

    I decided to start a thread concerning ideas & suggestions concerning rgedit. This would also include things I think might be interesting to have but for which I do not have the time, knowledge or resources to implement and test and, thus, where your help would be invaluable.
    Best wishes,
    Dan

     
  • Dan Dediu
    Dan Dediu
    2010-06-19

    As a seed, I list the following wishes and ideas I currently have:

    1. add more useful wizards: I am currently using Rcommander as an inspiration but more ideas would be great;

    2. add a searchable, etc. database of useful pieces of R code and associated resources: I think most of you know the feeling that at one point code to do some stuff was implemented but then we are unable to find it and we need to "reinvent the wheel". I often experience this and thus I think that a fully integrated and easy to search and extend database of such "partial solutions" to various problems would increase our productivity. Ideas about this are most welcome!

    3. rgedit on MacOS: I do not own a Mac and I have no idea if gedit has been ported (I assume it was) but I think it would be cool if somebody would try to make it work on this platform as well

    4. rgedit on MS Windows: I know it might sound strange for some, but some users of MS Windows might find this useful (I can think of people forced to use MS Windows for their job and would like the same tools on Windows and Linux). I tried a while ago to get gedit working on Windows (and it did!) but the process failed when I tried to get VTE working in Python! If anybody more able with porting such stuff to Windows could help this would be great

    Best,
    Dan

     
  • Mateusz Kaduk
    Mateusz Kaduk
    2010-06-24

    Hi :)

    My wishes besides some wanted features are mainly focused on making the plugin easier to work with and to attract new contributors.

    1. Clean up the code:

        * Different classes in different files
        * Complete featured object oriented design
        * Separate plugin logic from gui like MVC (model view controller)
        * Developer documentation (doxygen) <- How far project will go? Starting documenting code at beginning safes efforts when code grows.

    2. Add simple R auto-completion: for, switch, if, else with brackets

        * Write html->devhelp R documentation extractor and utilize devhelp gedit plugin for methods(..) auto-completion

    3. Redesign configuration window:

      * Maybe with tabs for General(plugin options), Console(font etc..), Editor(editor behaviour), Shortcuts(Vim/Emacs keybindings?).

      * Names for widgets and callbacks instead of "radio_button_cursor_blink1" -> "radio_button_blink_system" with name what exactly given callback or widget is for.

      * Maybe use GtkBuilder instead of LibGlade ? Since libglade is deprecated and builder is built into gtk+
      If so GUI files should be saved with .ui extension instead of .glade and in GtkBuilder format. Also should be loaded differently

    import pygtk
    pygtk.require("2.0")
    import gtk

    builder = gtk.Builder()
    builder.add_from_file(datadir+"/glade/Configuration.ui")
    builder.connect_signals(self)
    self.window = builder.get_object("configuration")

    4. Replace current html help with docbook documentation that can be easily converted to any format pdf,ps,html

    5. Roll down/up part of edited code in brackets ?

    Those are just some ideas that came to my head.

     
  • Dan Dediu
    Dan Dediu
    2010-06-24

    Hi,

    I totally agree with all your suggestions but maybe we should first address 2-5 and then focus on 1? I would rather prefer to give users a feature-rich "hack" first and then, while they happily use it, focus on a (major) rewrite and code cleanup without visible consequences…
    What do you think?

     
  • Dan Dediu
    Dan Dediu
    2010-06-24

    Concerning (5): I did a quick google on code folding and it seems the current status is:
    a) there is a plugin for code folding here (but I did not test it): http://code.google.com/p/gedit-folding/
        we might be able to adapt it for R
    b) there is work done in gtksourceview itself to allow code folding: http://live.gnome.org/GtkSourceView  and here:  https://bugzilla.gnome.org/show_bug.cgi?id=134610
        only for gtk+-2.8.0+

    In both cases we will probably have to somehow define R-aware folding (or maybe simply use C/C++/Java :) ). My preference would be to wait for a proper implementation in GtkSourceView but many people might need it and be stuck with older versions of gtk+ in which case it might be worth looking into the plugin…

     
  • Dan Dediu
    Dan Dediu
    2010-06-24

    Just checked the gedit folding plugin (you have to get it from here: http://github.com/mikecrittenden/gedit-folding) and seems to work quite fine both on Lenny and Fedora 13. It needs some work as now it is more like a proof-of-concept but seems a good place to start :) Things to be added (just at first sight):
    - sidebar markers
    - mouse interaction
    - tooltip
    - {} block awareness
    - …

     
  • Mateusz Kaduk
    Mateusz Kaduk
    2010-06-25

    As it comes to switching from LibGlade to GtkBuilder and redesigning UI, I cant do that.

    When it comes to multiple Consoles, I wrote ConsoleManager, which can easily keep track of all created consoles and attach them to gedit or remove. Maybe we can implement something like that but with all bunch of features ?

    import pygtk
    import gtk
    import vte
    class ConsoleManager():
        def __init__(self):
            self._instances = []
            self._names = []
        def createConsole(self, name):
            # Create terminal
            terminal = vte.Terminal()
            terminal.fork_command('/usr/bin/R')
            terminal.connect('child-exited', self.child_exited_callback)
            # Add terminal to scrolled window
            scrolledWindow = gtk.ScrolledWindow()
            scrolledWindow.add(terminal)
            scrolledWindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
            # Keep track of created terminals
            self._instances.append(terminal)
            self._names.append(name)
            # Return tab object
            return(scrolledWindow)
        def getConsoleNames(self):
            return(self._names)
        def getConsoleByName(self, name):
            for iname, itab in zip(self._names, self._instances):
                if iname == name:
                    return(itab)
        def getNameByConsole(self, terminal):
            for iname, itab in zip(self._names, self._instances):
                if itab == terminal:
                    return(iname)
        # When child process is terminated, remove tab
        def child_exited_callback(self, terminal):
            self._names.remove(self.getNameByConsole(terminal))
            self._instances.remove(terminal)
            gtk.Widget.destroy(terminal.get_parent())
    

    Similarly I gave an attempt to write a simple storage class, where you can have all getters/setters and just call LoadConfiguration/SaveConfiguration methods. This could be used in many places in plugin.

    Again just an idea

    import ConfigParser, os
    class Storage:          
        # Constructor
        def __init__(self):
            self.config = ConfigParser.ConfigParser()
            self.filename = os.path.expanduser('~/.rgedit.cfg')
            
        # Set default values
        self.console_autostart = True
            
        # If file does not exist, create default one
        if  os.path.isfile(self.filename):
            self.loadConfiguration()
        else:
            self.saveConfiguration()
        # Load configuration file and overide defaults
        def loadConfiguration(self):
            self.config.read(self.filename)
        if  self.config.has_option('Console','autostart'):
            self.console_autostart = self.config.get('Console', 'autostart', 0)
        # Save configuration file
        def saveConfiguration(self):
            if  self.config.has_section('Console') == False:
                self.config.add_section('Console')
            self.config.set('Console', 'autostart', self.console_autostart)
        with open(self.filename, 'wb') as configfile:
                self.config.write(configfile)
        # Get autostart boolean value
        def getAutostart(self):
            return self.console_autostart
            
        # Set autostart boolean value
        def setAutostart(self, autostart):
            self.console_autostart = autostart
    

    When it comes to docbook, I don't know about it anything either, but it looks for me like XML file with specific tags :)

    Finally when it comes to code folding, I agree that waiting for proper implementation on the gtksourceview level is much better.
    Those people are python masters! :)
    Anyway, I we have to think about autocompletion system and since there is already devhelp plugin for that, lets use it, we just need to write extractor of ugly R documentation.

    PS. Can we have new code in different files depending on what functionality it is adding ?

     
  • I have a suggestion (maybe there is a way to this easily but I'm not convinced).

    I using a lot the command line to write R, mainly because of the completion. Would it be possible with a simple shortcut to copy the content of the current line of the command prompt to the clipboard, or even paste it directly as the last line in the currently edited file? That would be great!

    Regards

    Alexandre

     
  • Dan Dediu
    Dan Dediu
    2010-07-14

    I using a lot the command line to write R, mainly because of the completion. Would it be possible with a simple shortcut to copy the content of the current line of the command prompt to the clipboard, or even paste it directly as the last line in the currently edited file?

    Hi Alexandre,

    indeed, your suggestions strikes me as perfectly fine and useful. However, due to the fact that R is running in a true terminal (which makes rgedit so light and fast), I do not have access to any internals of R's own console, including the concept of "the current line". Thus, the best I can do is provide you with a shortcut and/or a context menu entry allowing you to send the current selection to the file: would this be of any help to you?

    Alternatively, but very risky, I could think of a hack where I simply get the text from the console and try to guess what the current line, but this is just that: a hack…

    Best,
    Dan

     
  • Hi Dan

    Currently I select the line manually with the mouse (painful) then use the context menu to copy it to the clipboard. Adding something to copy the selection to the file would help but not much, the difficult part for me being the selection & copy with the mouse. I can't find a shortcut that would do the copy directly without popping up the context menu.

    My preferred solution would be to get the current line in the clipboard… potentially with a little hack ;)
    A similar solution would be to able to iterate the R command history directly in the text file, but I feel the same kind of hack should be used, which doesn't make it a better technical solution.

    Maybe I'm missing something with the integrated terminal…

    Alex

     
  • Dan Dediu
    Dan Dediu
    2010-08-10

    Hi Alex,

    sorry for the long delay. Now, I'm trying to see which usage scenario would be the best:
    1. you do your line completion in the R console (using the tab and what have you) and without actually running it you want to transfer it to the gedit tab where your current R source file is opened, or
    2. you do the same as above but you actually run the line and want to be able to send the last run line to the currently opened gedit tab
    These two apparently similar scenarios require quite different hacks and I would like to know which one would be the most natural for a user like you before I spend time trying to get it working :)

    Best,
    Dan

     
  • Hi Dan,

    I guess that my workflow would be more like 1, but 2 would still be ok.
    Basically what I like to do is type a command in the shell, with the help of completion etc… When I completed writing a command, I would usually first run it, to check if it's correct etc. Then I would bring back the last command and then manually copy paste it. At that point a key shortcut to copy it to the gedited file would be great. Does that make sense to you? Thanks.

    Alexandre

     
  • Dan Dediu
    Dan Dediu
    2010-08-13

    Hi Alexandre,

    would you mind if I send you a RCtrl.py and another file so that you can test the feature before I release it officially (it might take a while until the official release though :) )?

    Best,
    Dan

     
  • Hi Dan,

    No pb I'd be happy to test it out. Just point me where I should get the file and I'll give it a try. However I probably won't test it until Monday.

    Best,
    Alex

     
  • Dan Dediu
    Dan Dediu
    2010-08-13

    Just point me where I should get the file and I'll give it a try.

    do you have an e-mail address?

    Dan

     
  • Mateusz Kaduk
    Mateusz Kaduk
    2010-08-17

    Hi Dan,

    I just packaged 0.7.0.4 for Debian. You did not use git ;) but I did fix permissions in packaging script.

    Can you commit changes to git and then release from there in future ? That will keep final tarballs clean in regard to backup files and file permissions and will keep repository up to date.

    Secondly this is Debian issue, but is it Ok with You to change version naming from rgedit0.x.x.tar.bz2 to rgedit-0.x.x.tar.bz2 ?
    With additional "-" it will stop confusing Debian building system and in automatic way producing packages with 7.0.x version ;)

    Example: rgedit-0.7.0.5.tar.bz2

    That will help keeping Debian's version of package up to date really quick with just two commands.

    Regards,
    Mateusz

     
  • Dan Dediu
    Dan Dediu
    2010-08-18

    Hi Mateusz,

    nice to have you back :)

    I just packaged 0.7.0.4 for Debian.

    Great! I was wondering, given the recent freeze in Squeeze, what kind of new versions would be still accepted (if any)?

    You did not use git ;)

    You caught me :) Given that you've been away and I changed my distro in the meantime (back on Debian after an intermezzo with Fedora :) ) I fell back on my old habits. But I will use git from now on.
    As a matter of fact, I'm preparing 0.7.0.5 which includes two new features: the "copy last line" suggested by Alexandre Cesari a while ago and I also added the possibility to ude <Ctrl>C in the R console to copy the current selection, but I sill need to do some testing on them (maybe a couple of days).

    Can you commit changes to git and then release from there in future ? That will keep final tarballs clean in regard to backup files and file permissions and will keep repository up to date.

    Sure :)

    Secondly this is Debian issue, but is it Ok with You to change version naming from rgedit0.x.x.tar.bz2 to rgedit-0.x.x.tar.bz2 ? With additional "-" it will stop confusing Debian building system and in automatic way producing packages with 7.0.x version ;) Example: rgedit-0.7.0.5.tar.bz2 That will help keeping Debian's version of package up to date really quick with just two commands.

    No problem here!

    Would you still be interested & have the time to work on that atrociously designed preferences dialog of mine? ;p

    Best,
    Dan

     
  • Mateusz Kaduk
    Mateusz Kaduk
    2010-08-18

    Hi Dan,

    I am unfortunately out of any python coding till middle of October, this is deadline for my evaluation, so I need to speed up my work.
    After that period I don't think it should be a problem to redesign configuration dialog, but if anyone else wants to take over its fine.

    As it comes to Squeez freez.
    Yes, only packages containing important bug fixes can be exception, as fixes are still accepted but not new features and You need to ask for permission.
    Latest version is 0.7.0.2 so 0.7.0.4 is not making it to Squeez, unless we can have a good convincing bug fix in 0.7.0.5 ;)

    Thanks for replay !
    Regards,
    Mateusz

     

  • Anonymous
    2010-08-24

    Hi, I'm thinking translate this plug-in
    Is it possible make some changes on code to be easly translated? I mean put texts files outside the file or something like this.

    thanks in advance

     
  • Dan Dediu
    Dan Dediu
    2010-08-26

    Hi,

    this a very good idea - I'll have to look into it and find the best/easiest way of implementing it. If you are familiar with internationalization with Python I'd be more than happy to learn about it :)

    best,
    Dan

     
  • Herry
    Herry
    2010-12-02

    Hi,
    is there no auto-indentation for the code? It would be nice to select the code, click on something like "arrange code" and have the code indented.
    I quote the auto-completion feature in my wishes.
    Thnx for all you have done so far.

    Cheers,

    Herry

     
  • Dan Dediu
    Dan Dediu
    2010-12-02

    Hi Herry,

    there is a gedit plug in which does Indent/Unindent but I suppose you are thinking about a "smart" indent that would take a block of source and indent it according to some rules such as TAB+1 after {…, right?
    If so, I am not aware of any style guides concerning R code (of course, like everybody else I have my own actually a reflex of C++) and I could write such a thing but I would be a bit reluctant to impose it on other people :) Do you have some suggestions for such a style and/or different styles used by different people?

    Best,
    Dan

     
  • Herry
    Herry
    2010-12-03

    I've only been writing R code for two months, I was thinking at some facilities similar to those you have when writing Java with Eclipse (if you are familiar with it). I don't know any style guide concerning R, but I think you can use your style rules by default,it  maybe suitable for many people,  and then perhaps make the rules costomizable.
    The "TAB+1 after {… " should be a common rule in code writing, right? When programming I often go back in the code lines to wrap some portions of code into "new" blocks and I have to add tabs to the wrapped code to keep it clean…this is annoying (and boring). This rule would be of great help to me, would it for you?

    Cheers,

    Herry

     
  • Dan Dediu
    Dan Dediu
    2010-12-03

    Hi Herry,

    you convinced me :) I'll work on it but I can't tell you when it's gonna be ready :)

    Thanks for the suggestion,
    Dan

     

  • Anonymous
    2011-01-09

    rgedit on MacOS: I do not own a Mac and I have no idea if gedit has been ported (I assume it was) but I think it would be cool if somebody would try to make it work on this platform as well

    I installed gedit for mac on OS X 10.6 and copied your files to the plugins directory. It's shown on the plugins list, but if I try to select it it greys out. I don't know if there is errors are logged in gedit, but if so I'll be more than happy to share the logfile with you and fiddle around a bit.

    Joost

     
1 2 3 > >> (Page 1 of 3)