Bug 185218 - Focus problem for PYQT4 plasma Widget
Summary: Focus problem for PYQT4 plasma Widget
Status: RESOLVED DUPLICATE of bug 178378
Alias: None
Product: plasma4
Classification: Plasma
Component: containment-panel (show other bugs)
Version: unspecified
Platform: Unlisted Binaries Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-22 12:46 UTC by Nicola
Modified: 2009-02-24 09:18 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nicola 2009-02-22 12:46:53 UTC
Version:            (using KDE 4.2.0)
OS:                Linux
Installed from:    Unspecified Linux

Hi,
 I have written a very simple widget (http://www.kde-look.org/content/show.php/QuickUrl?action=content&content=99815)

If I use it on the desktop everything work fine... but if I add it on the menu panel I start to have focus problems for the linetext.

As soon as there are no application open (visible) on the desktop I can easily key in the information in the linetext but when I have visible application the focus is stolen from the linetext.

Maybe is a problem in my code.. Just for your reference..

Regards

-------------------------------------------------------------------
# -*- coding: utf-8 -*-

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyKDE4.plasma import Plasma
from PyKDE4 import plasmascript
from PyQt4 import QtGui
import webbrowser

class QuickUrl(plasmascript.Applet):
    def __init__(self,parent,args=None):        
        plasmascript.Applet.__init__(self,parent)
    

    def openUrl(self):      
        if (len(_text.text())>0):  
            webbrowser.open_new(_text.text())
            str = ""             
        else:
            QMessageBox.warning(None, "Warning","Please enter the URL!")            
         
    def init(self):
        global _text 
        global _label
        global _button
        _text = Plasma.LineEdit(self.applet)
        _text.setEnabled(True)    
        _text.setFocus()
        _label = Plasma.Label(self.applet)        
        _style=  "color:#000000;font-family:Arial,Verdana,Sans-serif;font-size:8pt;padding:0px;"
        _label.setText("Url")   
        _label.setEnabled(True)        
        _text.setStyleSheet(_style)        
        _button = Plasma.PushButton(self.applet)
        _button.setText("Open")   
        _button.setMaximumWidth(100)                          
        self.setHasConfigurationInterface(False)      
        self.setAspectRatioMode(Plasma.IgnoreAspectRatio)
        self.theme = Plasma.Svg(self)
        self.theme.setImagePath("widgets/background")
        self.setBackgroundHints(Plasma.Applet.DefaultBackground)
        self.layout = QGraphicsLinearLayout(Qt.Horizontal, self.applet)
        self.layout.addItem(_label)
        self.layout.addItem(_text)
        self.layout.addItem(_button)
        
        self.connect(_button, SIGNAL("clicked()"), self.openUrl)
        
        self.setLayout(self.layout)       
         
        self.resize(300,125)

def CreateApplet(parent):
    return QuickUrl(parent)
Comment 1 Aaron J. Seigo 2009-02-24 09:18:23 UTC
this is a general problem of the panel as it doesn't take focus when a focussable widget is purposefully given focus. there's a BR around here somewhere for this issue already.

btw, you can also ask devel related question on plasma-devel@kde.org ..

*** This bug has been marked as a duplicate of bug 178378 ***