[Gambas-user] Keyboard locked -- insisting one more time
Fernando Cabral
fernandojosecabral at ...626...
Sat May 13 19:11:40 CEST 2017
Thank you, Tobi for your patience explaining this whole thing.
Your comments make sense. No, as to the keyboard issue,
what I can not figure out boils down to two things: First, I have not
changed anything. At least that I know of.
Second, why I only see the problem with the gambas IDE? Everything else is
working fine.
I also have tried this:
a) installed Linux Mint 18.1 in a virtual box
b) mounted the original directories in the virtual box
c) installed gambas in the virtual machine
d) edited the original files in the virtual environment -- no problems
whatsoever.
The keyboard is the same. The hardware is the same. The operating system is
the same.
Nevertheless, the IDE behavior is different.
It must have something to do with the keyboard driver, but what?
I still can't see why this would only affect Gambas and nothing else. Not
even applications developed with gambas.
Anyway, I am glad you and others have tried so hard to help me.
- fernando
2017-05-13 13:07 GMT-03:00 Tobias Boege <taboege at ...626...>:
> On Sat, 13 May 2017, Fernando Cabral wrote:
> > Using IDE I can't edit my source code. It seems locked up. To no avail, I
> > have followed every hint I' ve received from you guys. I've done more. I
> > have uninstalled the whole gambas package. I have even searched every
> file
> > using find and locate so as not to leave any remains behind. I compressed
> > and save source code and moved all of them to a different directory.
> >
> > After that, I installed gambas3. The First time, I used apt-get and got
> an
> > older version. It did not work. I uninstalled and proceeded to full
> removal
> > again.
> > Then installed one more time using PPA. Again, it dis not work.
> >
> > I even tried using a virtual keyboard (Florence). Same problem.
> >
> > I am at a complete lost. I have no idea where else, or what else to look
> > for.
> >
> > Will someone be kind enough to tell me what the IDE looks for to decide
> if
> > the source code is locked or not for edition?
> >
> > One more note: I can use cut, copy and paste. Everything that can be done
> > with a mouse click works, but the keys used for editing are all locked
> > (arrows, character, pgdn, pgup, etc.)
> >
> > I've created a virtual machine with the same environment (linux mint
> 18.1).
> > There I can install gambas and change my source code.
> >
> > Any hints, no matter how crazy, will be much appreciated. I have already
> > lost a bunch of hours trying to figure this out, but have made no
> progress
> > so far.
> >
>
> I haven't been closely attending the other thread(s) but from this summary
> it sounds to me like the problem is somewhere between your keyboard and the
> IDE and not inside of the IDE. This would explain why chmod'ing didn't cure
> the symptom. I'll try to convince you of that below.
>
> It might still be a problem inside the graphical Gambas components, for
> instance, which handle keyboard input, but since you completely removed and
> re-installed Gambas multiple times and confirm it works under another
> installation of the same distribution, this sounds less likely than, say,
> an incompatibility or misconfiguration of another package. Then again this
> is also unlikely since Gambas is the only program that misbehaves, right?
>
> So, I have no other hints to give. But I can answer your question:
>
> > Will someone be kind enough to tell me what the IDE looks for to decide
> if
> > the source code is locked or not for edition?
>
> There are two ways to make files non-editable in the IDE: the first is
> making the project globally read-only, the other is locking specific files.
>
> For project-wide locking, quoting Project.module:Open() in the IDE source:
>
> 467 Public Function Open(sDir As String, Optional bInAnotherWindow As
> Boolean) As Boolean
> ...
> 523 ReadOnly = Not Access(sDir, gb.Write)
> 524
> 525 If Not ReadOnly Then
> 526 If Exist(sDir &/ ".startup") And If Not Access(sDir &/
> ".startup", gb.Write) Then ReadOnly = True
> 527 Endif
> 528
> 529 Try hLock = Lock sDir &/ ".lock"
> 530
> 531 If Not ReadOnly And ((bConvert And Exist(sDir &/ ".lock")) Or Not
> hLock) Then
> 532 If Message.Warning(("This project seems to be already
> opened.\n\nOpening the same project twice can lead to data loss."),
> 533 ("Open after all"), ("Do not open")) = 2 Then
> 534 Return True
> 535 Endif
> 536 Endif
>
> sDir is the project directory. So it first checks whether the project
> directory is writable by the current user. If the directory can be written
> to but the .startup file exists and is not writable, the project is also
> considered read-only.
>
> Looking further at line 531: the bConvert Boolean is not important (it is
> set when opening a Gambas 2 project inside the Gambas 3 IDE) and we can
> suppose it is False. Then the next condition is that hLock is Null. This
> happens precisely when the Lock instruction in line 529 fails, i.e. when
> the project is already opened by another instance of the IDE or the lock
> file was not removed by a previous IDE accessing the project (because it
> terminated abnormally for instance).
>
> The presence of the lock file does *not* set read-only mode. It just makes
> the IDE confirm that you know you're opening a locked project and you may
> do so and edit the project. If the project is globally read-only (by the
> project directory or .startup not being writable), the IDE tells you this
> after opening the project: see the attached screenshot.
>
> Locking individual files works basically the same. The locking mechanism
> is invoked from the Gambas form/code editor with the "Lock / unlock file"
> button, which you can see in the other attached screenshot. If a file is
> locked like this, the IDE displays an indication besides the file name,
> which the screenshot also shows.
>
> How does this type of locking work? Look at Editor/Code/FEditor.class:
>
> 3745 Public Sub Action_Activate((Key) As String) As Boolean
> 3746
> 3747 Select Case Key
> 3748
> 3749 Case ".locked"
> 3750 Project.SetReadOnly(Path, Action[Key, Me].Value)
>
> and then
>
> 5749 Public Sub SetReadOnly(sPath As String, bReadOnly As Boolean)
> ...
> 5768 If Stat(sPath).Type = gb.File Then
> 5769
> 5770 If bReadOnly Then
> 5771 Try Chmod sPath To "r-.r-.r-.."
> 5772 Else
> 5773 Try Chmod sPath To "rw.rw.r..."
> 5774 Endif
> 5775
> 5776 Endif
> 5777
> 5778 hForm = Files[sPath]
> 5779 If hForm Then Try hForm.SetReadOnly
>
> The read-only status of files is all about the file modes again, which you
> confirmed not to be the problem by chmod'ing.
>
> But how does the file read-only status get to the Gambas editor?
> See Editor/Code/FEditor.class:
>
> 2181 Public Sub SetReadOnly()
> 2182
> 2183 Dim bReadOnly As Boolean
> 2184
> 2185 If Project.ReadOnly Or If Project.Running Or If
> Project.IsReadOnly(Path) Then
> 2186 bReadOnly = True
> 2187 Endif
> 2188
> 2189 edtEditor.ReadOnly = bReadOnly
> 2190 If $hEditor1 Then $hEditor1.ReadOnly = bReadOnly
> 2191 If $hEditor2 Then $hEditor2.ReadOnly = bReadOnly
>
> It propagates the setting to the editor obejcts, which in turn, when
> read-only,
> refuse all key presses except IDE-specific hotkeys (you may convince
> yourself of
> that by looking at Editors_KeyPress()).
>
> There is another interesting detail in SetReadOnly(): if you trace the way
> from clicking the "Run" button (by which you start executing your project)
> from FMain.class over Project.module to Debug/Design.module, you arrive at
> the following:
>
> 771 Private Sub Start(sCmd As String)
> ...
> 838 For Each hForm In Project.Workspace.Windows
> 839 Try hForm.OnProjectDebug
> 840 Next
>
> since your project workspace will contain your editor windows, switch to
> the Editor/Code/FEditor.class:
>
> 2433 Public Sub OnProjectDebug()
> 2434
> 2435 SetReadOnly
> 2436 If Not Project.Running Then $hEditor.HideMessageLabel
> 2437
> 2438 End
>
> Long story short: when you run a project, all open editors are locked. You
> probably already knew that. But this sort of locking boils down to the same
> primitives that are also used by the IDE when files are read-only locked.
>
> Now my point is: in my experience you can't paste text into the editors by
> any means when the project runs. Since you said you can do that and the
> "project is running" editor locking is the same as "the file is locked"
> locking, this implies that your editors are not actually locked and the
> problem must be outside of the IDE.
>
> [ Disclaimer: I only grep'd through the IDE source code with
> "read-?only|lock"
> and followed everything I deemed meaningful, so I might have missed
> something,
> but the things I found are the only behaviours of the IDE wrt locking
> that
> I ever experienced. ]
>
> But can you create and edit newly created projects? It would be worth a
> shot
> to create a project which uses gb.form.editor. Put a TextEditor on your
> form
> and run it. I think this editor control is the same one that the IDE uses.
> Let's see if it accepts key presses outside of the IDE or not.
>
> Regards,
> Tobi
>
> --
> "There's an old saying: Don't change anything... ever!" -- Mr. Monk
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
--
Fernando Cabral
Blogue: http://fernandocabral.org
Twitter: http://twitter.com/fjcabral
e-mail: fernandojosecabral at ...626...
Facebook: f at ...3654...
Telegram: +55 (37) 99988-8868
Wickr ID: fernandocabral
WhatsApp: +55 (37) 99988-8868
Skype: fernandojosecabral
Telefone fixo: +55 (37) 3521-2183
Telefone celular: +55 (37) 99988-8868
Enquanto houver no mundo uma só pessoa sem casa ou sem alimentos,
nenhum político ou cientista poderá se gabar de nada.
More information about the User
mailing list