[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyKDE] [ERIC3][PATCH] Open python file on double click
From:       Stephan Jaensch <sjaensch () gmx ! net>
Date:       2002-12-19 12:00:44
[Download RAW message or body]

Hi,

recently I've started playing a bit with Python, PyQt and eric and I am 
stunned so far! One little thing disturbed me with eric: It didn't open 
python files when double-clicked in the project browser, I have to use the 
context menu. The attached patch fixes this, altough I am sure this is not 
the best way to do it. :-)

I didn't quite get it why the Browser class maintains it's own curItem, 
instead of using currentItem() from the parent QListView class. I've changed 
it in the handleOpen() method, but haven't touched it anywhere else. If this 
is wrong please revert it and instead insert

self.listView().curItem = self

before the manual calls to handleOpen() in the setOpen() methods.

Ciao...
["eric-openOnDoubleClick.patch" (text/x-diff)]

--- eric/Browser.py	Thu Dec 19 11:30:21 2002
+++ /usr/lib/python2.2/site-packages/eric3/Browser.py	Thu Dec 19 11:36:06 2002
@@ -175,6 +175,8 @@
         if not self.isPythonFile():
             return
             
+        self.listView().handleOpen()
+
         if o:
             try:
                 dict = pyclbr.readmodule_ex(self.moduleName, [self.dirName])
@@ -249,6 +251,8 @@
                 self.setExpandable(1)
                 
     def setOpen(self, o):
+        self.listView().handleOpen()
+
         if o:
             if self.cl is None:
                 return
@@ -293,6 +297,9 @@
         self.setPixmap(0, IconMethod)
         self.setText(0, "def " + name + "(...)")
 
+    def setOpen(self, o)
+        self.listView().handleOpen()
+
 
 class Browser(QListView):
     """Browser(self,parent=None)
@@ -420,7 +427,7 @@
         """
         Private slot to handle the open popup menu entry
         """
-        itm = self.currItem
+        itm = self.currentItem()
         
         try:
             if isinstance(itm, BrowserFile):

_______________________________________________
PyKDE mailing list    PyKDE@mats.gmd.de
http://mats.gmd.de/mailman/listinfo/pykde

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic