Giter VIP home page Giter VIP logo

Comments (25)

arakel2 avatar arakel2 commented on June 30, 2024 1

@jcfaria
Have a nice day 😄
BTW: Nice your Tinn-R Editor

from cuda_exterminal.

Alexey-T avatar Alexey-T commented on June 30, 2024

The option to send an entire file

Where is this option, what do you mean?

from cuda_exterminal.

jcfaria avatar jcfaria commented on June 30, 2024

I believe the attached figures speak for themselves.

Another thing that I can't understand is why it doesn't open any dialog, file, etc., when I try to configure the plugin. In this case I'm trying to go through the main menu to its settings (see figure).

The only thing I managed to configure well were the plugin's "hotkeys".

About hotkeys, they should actually be called "shortcuts". "Hotkeys" (in the literal sense) are hot keys associated with the operating system. In other words, once keyed, if an application has registered it with the operating system (usually the application that registered last), the operating system will send the hotkeys to the application that registered it, regardless of the window currently focused on. that the hotkey (usually a combination of keys) was keyboard).

ExTerminal_Run_current_file
ExTerminal_Config

from cuda_exterminal.

arakel2 avatar arakel2 commented on June 30, 2024

Maybe a quick fix, just for you:
In cudatext\py\cuda_exterminal\__init__.py find:
about line 174 and modify according your needs:

    def run_current_file(self):
        fn = ed.get_filename() 
        fn = fn.replace('\\','\\\\')
        if fn:
            t = self.get_active_terminal()
            if t:
                self.show_terminal(t)
                t.write('source("'+fn+'", echo=FALSE, ...)\r')

fn = fn.replace('\\','\\\\') will replace "\" by "\\"
and in the last line you just add your prefix and endfix.
t.write('source("'+fn+'", echo=FALSE, ...)\r')

This will generate your requested:
source("C:\\User\\XXX\\Documents\\path_of_file.R", echo=FALSE, ...)

Cheers Arakel

from cuda_exterminal.

jcfaria avatar jcfaria commented on June 30, 2024

@arakel2

I'm grateful for the tip, it contributes to my studies in Python and I can now intervene in the plugin's source code where necessary.

However, I would like a more comprehensive proposal, where I could change the content of what will be sent through a dialogue, as this can be changed according to need. Can you understand?

from cuda_exterminal.

arakel2 avatar arakel2 commented on June 30, 2024

@jcfaria
I understand that completely. I just changed the code for my needs and saw your request. For a quick solution, I sent a proposal. Of course, this is not enough for a comprehensive realization. What do you think, is it sufficient to generate a fixed format (stored in the configuration) or is a per-call solution desirable.

from cuda_exterminal.

jcfaria avatar jcfaria commented on June 30, 2024

@arakel2

I believe it will be necessary to add more options in the shipping menu:

  • Run current file
  • Run current file (custom 1)
  • Run current file (custom 2)

Additionally, the user can also inform how he wants the string to be constructed that will be sent to the interpreter with custom 1, custom 2, etc.

The first option (Run current file) may be the current default, as many users (especially Python users) must use it as is. For other interpreters, in this case R, it will be necessary to expand (much more and progressively) the sending options. That's where custom 1, custom 2, ...

I find this plugin an ideal candidate - according to my tests - to make it a powerful GUI for the R interpreter to be used with CudaText.

from cuda_exterminal.

arakel2 avatar arakel2 commented on June 30, 2024

@jcfaria
Well I installed CudaText yesterday (as an alternative for overloaded IDE or challenging VIM)
The options in the menu are defined in cudatext\py\cuda_exterminal\install.inf, it is easy to add some items.
In cudatext\py\cuda_exterminal\__init__.py just copy, paste, rename and modify the functions:

def run_current_file(self):
    ....

def run_current_file_c1(self):
    .....

def run_current_file_c2(self):
    .....

And in cudatext\py\cuda_exterminal\install.inf something like:

[item7]
section=commands
caption=ExTerminal\Run current file custom 1
method=run_current_file_c1

[item8]
section=commands
caption=ExTerminal\Run current file custom 2
method=run_current_file_c2

If you like to have the pre- and suffixes in a config file as:
Pre-Custom1 and End-Custom1
Pre-Custom2 and End-Custom2

"We have to find it"
I don't know right now, but it should be possible to manage.

from cuda_exterminal.

jcfaria avatar jcfaria commented on June 30, 2024

@arakel2

I'm leaving to teach at the (public) University where I work. Tomorrow I'll take a look at your code and we'll talk more...

from cuda_exterminal.

jcfaria avatar jcfaria commented on June 30, 2024

@arakel2

Vim (and NeoVim) are really challenging!

I use them - preferably - when I'm working with Linux. My current favorite flavor (I've been through almost all the major matriarchs - Debian, Fedora, etc) is OpenSuse.

He has already contributed to the source code of the Nvim-R plugin, which runs R both in Vim and Neovim. For me, they are the best tools today for dealing with texts (R scripts among them).

But lately, due to classes at University, I've been using Windows more. And on Windows, I prefer to work with Tinn-R, which I have also been developing for many years.

But I follow and appreciate the work of Alexey and his assistants with good eyes... full of hope, as a future alternative to Vim for all operating systems.

from cuda_exterminal.

Alexey-T avatar Alexey-T commented on June 30, 2024

Another thing that I can't understand is why it doesn't open any dialog, file, etc., when I try to configure the plugin. I

Here (Linux) it opens the file settings/plugins.ini and writes there section, and opens it. Does Console panel (ctrl+tilde hotkey) show some error?

from cuda_exterminal.

Alexey-T avatar Alexey-T commented on June 30, 2024

However, I would like a more comprehensive proposal, where I could change the content of what will be sent through a dialogue

Try to add the string option. its value can be string. if empty - current work. if not empty - program can use this string when running the file, e.g. insert line which you wrote.

from cuda_exterminal.

jcfaria avatar jcfaria commented on June 30, 2024

Here (Linux) it opens the file settings/plugins.ini and writes there section, and opens it. Does Console panel (ctrl+tilde hotkey) show some error?

ERROR: Exception in CudaText for config: Unable to create file "C:\Users\jcfaria\Dropbox$_progs_port\cudatext\settings\plugins.ini": The file is already in use by another process.

from cuda_exterminal.

jcfaria avatar jcfaria commented on June 30, 2024

Try to add the string option. its value can be string. if empty - current work. if not empty - program can use this string when running the file, e.g. insert line which you wrote.

I will try some options...
Is the plugin author (@veksha) no longer active?
He did a really hard job!

from cuda_exterminal.

Alexey-T avatar Alexey-T commented on June 30, 2024

ERROR: Exception in CudaText for config: Unable to create file "C:\Users\jcfaria\Dropbox$_progs_port\cudatext\settings\plugins.ini": The file is already in use by another process.

It is the reasonable error, app cannot create (write settings to) plugins.ini.

from cuda_exterminal.

jcfaria avatar jcfaria commented on June 30, 2024

It is the reasonable error, app cannot create (write settings to) plugins.ini.

I'm noticing now that when I try to open the plugin settings via the Option/Settings - plugins menu, everyone tries to open the file "C:\Users\jcfaria\Dropbox$progs_port\cudatext\settings\plugins.ini" give the same error message. Do you have any suspicions? Could it be due to the use of "$" in the path? Or be on Dropbox?

from cuda_exterminal.

Alexey-T avatar Alexey-T commented on June 30, 2024

What if you enter this cmd in the Console (and press Enter), does it create plugins.ini section [aa] bb=1 ?

ini_write(r"C:\Users\jcfaria\Dropbox$progs_port\cudatext\settings\plugins.ini", 'aa', 'bb', '1')

from cuda_exterminal.

jcfaria avatar jcfaria commented on June 30, 2024

Nothing happens, no writing, no error message, nothing.
ini_write

from cuda_exterminal.

Alexey-T avatar Alexey-T commented on June 30, 2024

Seems this plugins.ini is write protected at some times. what I can do? handle the write error and show civil messagebox about it?

from cuda_exterminal.

jcfaria avatar jcfaria commented on June 30, 2024

@Alexey-T
I noticed that this "bug" is associated with some plugins that try to access the .\cudatext\settings\plugins.ini file, but not all!

And what's worse (I'm testing it again now) is that it's intermittent! In other words, sometimes it opens and other times it doesn't open the file.

When it doesn't open, the error message is always the same, it has a pattern (see below). My suggestion is that once the message is captured, it displays an informative dialog for the user to open the file manually. The silence is what's annoying, the user doesn't always have the Console interface open to check whether it's an error.

I'll test, but I'm very suspicious that this error could be Dropbox blocking access to the file, since it is updated frequently.

ERROR: Exception in CudaText for config: Unable to create file "C:\Users\jcfaria\Dropbox$_progs_port\cudatext\settings\plugins.ini": The file is already in use by another process.

from cuda_exterminal.

jcfaria avatar jcfaria commented on June 30, 2024

@Alexey-T
The origin of the "bug" found!

As I had suspected, Dropbox is blocking - intermittently - the .\settings\plugin.ini file

I believe you have a few options for these cases:

  1. Check the file status (whether or not it is blocked) before trying to open it. If it is not blocked, it opens normally. If it is blocked, give a message to the user whether he wants (or not) to force it to open.

  2. Give the blocking warning and let the user open it manually.

Regardless of the option, I think you should check the status of the .\settings\plugin.ini file before trying to open it and always notify the user if there is a problem.

from cuda_exterminal.

Alexey-T avatar Alexey-T commented on June 30, 2024
  1. Do you know HOW to check the file, is it blocked or not?
  2. it is not very good to add checking for blocked file, because we have tons of plugins which do the same thing on Config command:

file_open(file_path_to_plugins.ini)

from cuda_exterminal.

jcfaria avatar jcfaria commented on June 30, 2024

@Alexey-T

Do you know HOW to check the file, is it blocked or not?

I have been using the function below in Delphi:

// From: https://www.swissdelphicenter.ch/en/showcode.php?id=104
function fIs_FileInUse(FileName: TFileName): boolean;
var
  hFileRes: hFile;

begin
  Result := False;
  if not FileExists(FileName) then
    Exit;

  hFileRes := CreateFile(PChar(FileName), GENERIC_READ or GENERIC_WRITE, 0, nil, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);

  Result := (hFileRes = INVALID_HANDLE_VALUE);

  if not Result then
    CloseHandle(hFileRes);
end;

from cuda_exterminal.

Alexey-T avatar Alexey-T commented on June 30, 2024

Well, this func is Win32 only and Pascal based. while Win only is okay (if Dropbox makes issue on Win only), we need Python.

from cuda_exterminal.

jcfaria avatar jcfaria commented on June 30, 2024

Well, I don't know if I'll be able to learn Python well during my current stay on the planet where we are. :)

from cuda_exterminal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.