You are not logged in.

#1 2008-06-25 21:14:20

Aprz
Member
From: Newark
Registered: 2008-05-28
Posts: 277

[Solved]PyPanel w/ Rab Fails To Apply Patch

Well, I decided that if the patch wasn't going to work then I was going to edit the file myself (I made a backup before doing so) and I tried making sense of it (I don't know Python, but I do know several other programming languages so it wasn't too difficult to understand it) and I was able to edit /usr/bin/pypanel manually and change line 62 to make it float. This is my own method so I am not sure how good it is but I'll share, where it says P_LOCATION, I just subtracted however much pixels I wanted it to float so for example:

self.window = self.screen.root.create_window(P_START, (P_LOCATION - 5),

It was easy, quick and painless.

Edit: Now I get/understand the patch and how it works! I wish it clicked in my head earlier. sad Ironically, the only way I would have ever understand it was to look inside of /usr/bin/pypanel.

Hello, I'm trying to make PyPanel float using a patch called rab, but I am getting some errors when I try to apply the patch. I did some Googling and found a thread from here that had instructions on it, but I was still unsuccessful and I am having difficulties interpreting the error message.

When you download rab, it's not exactly the same as shown on the website (not too much of a difference). Two things I noticed is that it does contained @@ at the beginning of line 3 which I believe it is suppose to, but it doesn't show that on the website (I talked with some other people about this and they thought that might of been the problem looking from the site). Another odd thing is it doesn't close it's parentheses on like 34; it just ends with a comma. I've tried messing around with the file such as adding an ending parentheses to it and removing the last comma, but it produces the same error message.

This is what the file exactly looks like on my computer and it is saved as rab:

--- ./pypanel    2005-06-26 16:24:43.000000000 -0700
+++ ./pypanel    2006-10-22 13:47:00.000000000 -0700
@@ -44,19 +44,28 @@
         self.focus   = 0                         # Currently focused window
         self.rpm     = None                      # Root pixmap ID
                 
-        global P_HEIGHT, P_WIDTH, P_LOCATION
-        
+        global P_HEIGHT, P_WIDTH, P_LOCATION, P_B_BUFF, P_T_BUFF, P_L_BUFF, P_R_BUFF, P_START
+       
         # Misc. initializations
         if SHOWLINES or SHOWBORDER:
             self.lgc = self.root.create_gc(foreground=self.getColor(LINE_COLOR))
         if not P_WIDTH:
             P_WIDTH = self.screen.width_in_pixels - P_START
+        elif P_WIDTH:
+        P_WIDTH -= P_START
+    if P_L_BUFF != 0 and P_R_BUFF != 0:
+        P_WIDTH -= P_R_BUFF + P_START + P_L_BUFF
+        P_START += P_L_BUFF
         if SHOWBORDER:
             P_HEIGHT += 2 
         if P_LOCATION:
             P_LOCATION = self.screen.height_in_pixels - P_HEIGHT
-        else:
+        if P_B_BUFF != 0:
+            P_LOCATION -= P_B_BUFF
+    else:
             P_LOCATION = 0
+        if P_T_BUFF != 0:
+            P_LOCATION = P_T_BUFF
         
         # Setup the panel's window
         self.window = self.screen.root.create_window(P_START, P_LOCATION,

Now this is what I do exactly as root:

[root@Aprz andrew]# cp rab ~
[root@Aprz andrew]# cp /usr/bin/pypanel ~
[root@Aprz andrew]# cd ~
[root@ Aprz ~]# ls
pypanel  rab
[root@Aprz ~]# patch -Ng1 < rab
patching file pypanel
patch unexpectedly ends in middle of line
Hunk #1 FAILED at 44.
1 out of 1 hunk FAILED -- saving rejects to file pypanel.reg
[root@Aprz ~]# ls
pypanel  pypanel.orig  pypanel.rej  rab

This is pypanel.rej:

***************
*** 44,62 ****
          self.focus   = 0                         # Currently focused window
          self.rpm     = None                      # Root pixmap ID
                  
-         global P_HEIGHT, P_WIDTH, P_LOCATION
-         
          # Misc. initializations
          if SHOWLINES or SHOWBORDER:
              self.lgc = self.root.create_gc(foreground=self.getColor(LINE_COLOR))
          if not P_WIDTH:
              P_WIDTH = self.screen.width_in_pixels - P_START
          if SHOWBORDER:
              P_HEIGHT += 2 
          if P_LOCATION:
              P_LOCATION = self.screen.height_in_pixels - P_HEIGHT
-         else:
              P_LOCATION = 0
          
          # Setup the panel's window
  
--- 44,71 ----
          self.focus   = 0                         # Currently focused window
          self.rpm     = None                      # Root pixmap ID
                  
+         global P_HEIGHT, P_WIDTH, P_LOCATION, P_B_BUFF, P_T_BUFF, P_L_BUFF, P_R_BUFF, P_START
+        
          # Misc. initializations
          if SHOWLINES or SHOWBORDER:
              self.lgc = self.root.create_gc(foreground=self.getColor(LINE_COLOR))
          if not P_WIDTH:
              P_WIDTH = self.screen.width_in_pixels - P_START
+         elif P_WIDTH:
+         P_WIDTH -= P_START
+     if P_L_BUFF != 0 and P_R_BUFF != 0:
+         P_WIDTH -= P_R_BUFF + P_START + P_L_BUFF
+         P_START += P_L_BUFF
          if SHOWBORDER:
              P_HEIGHT += 2 
          if P_LOCATION:
              P_LOCATION = self.screen.height_in_pixels - P_HEIGHT
+         if P_B_BUFF != 0:
+             P_LOCATION -= P_B_BUFF
+     else:
              P_LOCATION = 0
+         if P_T_BUFF != 0:
+             P_LOCATION = P_T_BUFF
          
          # Setup the panel's window

What's odd is there isn't even a line 44 so what is the error message talking about?

Anyhow, I've been doing a lot of Googling and talking with some other people, but no solution has been found. They recommened that I should probably try finding another method to make it float because a lot of the post that are about rab are outdate (2007) and it doesn't seem like anyone has poked at it since then, but I'll give rab one last try here.

Last edited by Aprz (2008-06-26 09:46:19)

Offline

Board footer

Powered by FluxBB