jijo-paulose / ulipad

Automatically exported from code.google.com/p/ulipad
0 stars 0 forks source link

The cursor should be put on current window when switch between windows by Ctrl+Tab #166

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Open multi-windows
2. Using Ctrl+Tab switch to another window

What is the expected output? What do you see instead?
When switch to another window, the cursor still stay at original window. 
So if you type something, the input are in a hidden window.

What version of the product are you using? On what operating system?
3.9, WinXP

Please provide any additional information below.

Original issue reported on code.google.com by working...@gmail.com on 2 Dec 2008 at 1:11

GoogleCodeExporter commented 9 years ago
I'm too lazy to dig into source code. I think it is a minor bug and relatively 
easy 
to fix. So I put it on this issue board.

Anyway it is an old bug, why no one reports it before?

Original comment by working...@gmail.com on 2 Dec 2008 at 1:13

GoogleCodeExporter commented 9 years ago
Thanks I also know it, but because I use flatnotebook control, and I don't know 
how
to fix it yet. Maybe someone could help me.

Original comment by limo...@gmail.com on 3 Dec 2008 at 12:43

GoogleCodeExporter commented 9 years ago
I think that you should look at this event:

wx.EVT_FLATNOTEBOOK_PAGE_CHANGED

Original comment by vinet...@gmail.com on 16 Dec 2008 at 2:22

GoogleCodeExporter commented 9 years ago
So anyone who is familiar with the ulipad code can help to fix this bug?
Thanks!

Original comment by working...@gmail.com on 16 Dec 2008 at 2:25

GoogleCodeExporter commented 9 years ago
This is merely a boiler-plate code:

self.flatnotebook_page.Bind(event=wx.EVT_FLATNOTEBOOK_PAGE_CHANGED,
handler=self.OnPageChange)

def OnPageChange(self, event=None):
    self.flatnotebook_page.SetFocus()

Original comment by vinet...@gmail.com on 18 Dec 2008 at 9:12

GoogleCodeExporter commented 9 years ago
There is already this thing in EditorFactory.py, you can see:

        FNB.EVT_FLATNOTEBOOK_PAGE_CHANGED(self, self.id, self.OnChanged)

Original comment by limo...@gmail.com on 18 Dec 2008 at 11:53

GoogleCodeExporter commented 9 years ago
I can't reproduce this bug. I open the Shell window in UliPad and then when I 
change
to another application by pressing Alt+Tab and then back to UliPad, the cursor 
blinks
in the Shell window again. I used the SVN version of UliPad to test that and 
used
Python 2.5.2 (32-bit interpreter) and wxPython 2.8.9.1. Please tell me what bug 
are
you talking about. I need you to be more specific.

workingpad, have you tried to reproduce this bug with the SVN version of UliPad?
Also, please tell us which version of Python and wxPython do you have installed 
on
your computer. Also, which version of comtypes do you have? Please try the SVN
version with the current Python, wxPython and comtypes. Because the UliPad's 
source
code looks okay to me.

Original comment by vinet...@gmail.com on 19 Dec 2008 at 10:39

GoogleCodeExporter commented 9 years ago
workingpad is talking about Ctrl+Tab but now switching between shell and 
document 
area. I know what he said and I also tried to fix it, but I failed.

Original comment by limo...@gmail.com on 19 Dec 2008 at 1:07

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I made a patch that fixes this bug 100%.

Original comment by vinet...@gmail.com on 19 Dec 2008 at 2:51

Attachments:

GoogleCodeExporter commented 9 years ago
As it turns out, this patch does move the caret into the page you switch to. 
But when
you type something, the characters are still sent into the previous page. 
Fixing the
method on_kill_focus is good, but we have to fix the other thing as well. So I 
must
correct myself and say that the patch fixes 50% of the bug. It was a nice try 
though.
Limodou, please apply my patch anyway.

Original comment by vinet...@gmail.com on 19 Dec 2008 at 7:54

GoogleCodeExporter commented 9 years ago
I think I fixed it in mEditor.py.

Original comment by limo...@gmail.com on 20 Dec 2008 at 2:39

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Yeah, you fixed it. Good job, Limodou! But still, you need to fix the 
on_kill_focus()
method because it has a bug. I think that you tried to give the variable 
command_mode
a boolean value True and then make the method return that value. You can't use 
the
keyword 'is' because it is ment for checking if, in our case, the variable
command_mode is *the same object* as True. Even though this works, you need to 
set
the variable command_mode a value of True and then return that value. Please 
apply my
patch in comment 10 because it fixes that method. Thanks for fixing this 
long-lasting
bug.

Original comment by vinet...@gmail.com on 20 Dec 2008 at 10:34

GoogleCodeExporter commented 9 years ago
No, I just want to test whether a variable is True, the *is* is the right 
thing. And 
it's not a bug, it just likes:

f = v is True
return f

and you can write above code like:

return v is True

Original comment by limo...@gmail.com on 20 Dec 2008 at 10:40

GoogleCodeExporter commented 9 years ago
Limodou, I must tell you something. The keyword 'is' checks if two objects are 
of the
same type, and the '==' sign checks if an object has the specified value after 
the
'==' sign.

Try it in the interpreter:
>>> 1 is True
False

You are testing here if the type 'int' is the same object as the type 'bool', 
and you
get the response that it is not.

>>>type(1)
<type 'int'>
>>>type(True)
<type 'bool'>

You can see that those two objects are of different type. The keyword 'is' 
checks if
two objects are the same type. If you want to test the value of one object, 
then use
the '==' sign.

>>>1 == True
True

Here you check what the boolean *value* (True or False) of the integer type is. 
By
default, everything in Python is True except 0, None, False, [], '', {} ...

In the method on_kill_focus(), the returned value is *always False* because 
'return
command_mode is True' first checks if command_mode and True are both bool types 
and
then returns that value. And since command_mode is not a bool type, the answer 
of
'command_mode is True' always gives False and the method on_kill_focus() always
returns False. It would return True *only* then when you make the variable
command_mode be a bool type, like if you would do 'command_mode = False' or
'command_mode = True' in the *same* namespace as the test 'command_mode is 
True' exists.

Original comment by vinet...@gmail.com on 20 Dec 2008 at 12:09

GoogleCodeExporter commented 9 years ago
Yes I want to test True. And *is* is not used to test type, but an object *is* 
the 
object. So how do you test a object equal None object. You can only use a is 
None. I 
don't think command_mode is True will always return False, here is a test:

>>> a = False
>>> print a is True
False
>>> a = True
>>> print a is True
True

So you can see if you set variable to True, the result is True. You are wrong 
at this 
point. *is* is not '=='. And command_mode is exact a boolean variable. You can 
see 
the code in  mixins/SearchWin.py:

        Globals.mainframe.command_mode = True

No one said command_mode is not a boolean variable.

Original comment by limo...@gmail.com on 20 Dec 2008 at 1:21

GoogleCodeExporter commented 9 years ago
I see. You are right. Okay since this issue has been fixed, please change the 
status
of this issue to Fixed.

Original comment by vinet...@gmail.com on 20 Dec 2008 at 1:51

GoogleCodeExporter commented 9 years ago

Original comment by limo...@gmail.com on 20 Dec 2008 at 1:59

GoogleCodeExporter commented 9 years ago
Well, thanks for all of you, ulipad guys!

Original comment by working...@gmail.com on 22 Dec 2008 at 4:47