Anonymous avatar Anonymous committed 1ee124e

Only close when it loses focus or the center image gets clicked.

Comments (0)

Files changed (1)

 
 plan: 
 
-- Initialize a window at mouse position (QCursor::pos(); QLayoutItem::setGeometry(Qrect))
-- Show the program cathegories from the K-Menu in a circle. 
+- Initialize a window at mouse position (QCursor::pos(); QLayoutItem::setGeometry(Qrect)) -done
 - Make the window transparent, without background, border and menubar. 
+- Show icons in a circle
+- make the icons clickable
+- add folder-icons
 - Implement registering a global shortcut in KDE within the program. 
 
 ideas: 
 
 - use plasma. 
-
+- Show the program cathegories from the K-Menu
 
 set a position
 
         # Quit when this window gets closed
         self.setAttribute(Qt.WA_QuitOnClose)
         self.setAttribute(Qt.WA_DeleteOnClose)
-        #self.setAttribute(Qt.WA_TranslucentBackground)
+        self.setAttribute(Qt.WA_TranslucentBackground)
 	
 	# resize
 	self.resize(WINDOW_WIDTH, WINDOW_HEIGHT)
 	self.circle = []
 	
 	self.label = QLabel(self)
+	self.label.name = "center"
 	self.label.setPixmap(self.iconloader.loadIcon("kreversi", 0))
 	
 	self.circle.append(self.label)
 	for name in ["kopete", "kmail", "kmix", "wesnoth", "kate"]: 
 	    label = QLabel(self)
+	    label.name = name
 	    label.setPixmap(self.iconloader.loadIcon(name, 0))
 	    self.circle.append(label)
 	    
 
         TODO: Only close when the mouse is released on a final item or outside.
         """
-        if self.isInsideWindow(event.pos()): 
-	    for label in self.circle: 
-		label.destroy()
-            self.close()
-
+	hit = False
+	for i in self.circle: 
+	    if self.isInside(event.pos(), i): 
+		print i.name
+		hit = True
+		if i.name == "center": 
+		    for label in self.circle: 
+			label.destroy()
+		    self.close()
+		    
+    def isInside(self, point, thing):
+	"""Check, if the point is inside the thing."""
+	if point.x() > thing.x() and point.x() < thing.x() + thing.width() and point.y() > thing.y() and point.y() < thing.y() + self.height():
+            return True
+        else:
+            return False
+	
     def isInsideWindow(self, point):
         if point.x() > 0 and point.x() < self.width() and point.y() > 0 and point.y() < self.height():
             return True
 	
 	# Now all others: 
 	for i in self.circle[1:]: 
-	    print i
 	    angle = 2 * pi * (self.circle.index(i) -1 ) / len(self.circle[1:])
 	    x_displacement = sin(angle)*CIRCLE_RADIUS
 	    y_displacement = cos(angle)*CIRCLE_RADIUS
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.