Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
GPytage
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
Ken69267
Developer
Developer


Joined: 08 Apr 2007
Posts: 111
Location: #gentoo-pr0n

PostPosted: Tue Dec 25, 2007 5:33 pm    Post subject: GPytage Reply with quote

So it's that time again for me to release another crappy python application some may use hopefully :P. Today I will be introducing GPytage, a graphical way to edit Portage's package.* files. It uses the GTK toolkit via PyGTK and is coded in Python. It is currently in Alpha stage and you can get it here or if you like sourceforge here.

Currently there isn't an ebuild as I don't have much spare time these days, so if anyone wants to make one please attach it here or on the gna project site. If you wish to file a bug or suggestion please also use gna instead of sourceforge if possible.

A screenshot of GPytage can be seen here: http://omploader.org/vOWgw/gpytage-0.png
_________________
!snack
Back to top
View user's profile Send private message
dol-sen
Developer
Developer


Joined: 30 Jun 2002
Posts: 2805
Location: Richmond, BC, Canada

PostPosted: Thu Dec 27, 2007 7:20 am    Post subject: Reply with quote

I've just started poking around in it. So far I think you should add some popup dialog boxes for some of your ioerror exceptions rather than just the print statements which are only good if you run your script from a termina (which I didn't)l. Also if you move your savefile module to a script of its own, it can then be run as a normal user and then invoke the savefile script from gksu/gksudo to get root privelidges only for the save. You can look at how we do it in porthole if you need an example.

So far I think it is on the right track. A little more work and it should be very useful for re-organizing and cleaning out those files. I think you should also include a check for sets and include those as well. Pkgcore and paludis have set support already, portage has set support in the works and I have partial sets support built in to porthole's cvs version.

As for your todo about splitting files like a package.keywords file into a dir and subfiles it might be better to make two window panes similar to porthole and other frontends with the primary file/dir and subfile name in the left pane and the file contents in the right pane. It could make it much easier for drag and drop re-organizing/file splitting. It is how I use a file manager for moving files around when I need to.

A few minor mods and your script could easily be interfaced as a plug-in to porthole, portato, etc..

Keep up the good work :)
_________________
Brian
Porthole, the Portage GUI frontend irc@freenode: #gentoo-guis, #porthole, Blog
layman, gentoolkit, CoreBuilder, esearch...
Back to top
View user's profile Send private message
Ken69267
Developer
Developer


Joined: 08 Apr 2007
Posts: 111
Location: #gentoo-pr0n

PostPosted: Thu Dec 27, 2007 8:56 pm    Post subject: Reply with quote

Thanks for the feedback :D

I'm planning a complete overhaul to the save function, so I'll see about moving it to its own script. Mainly I want it to be able to just save the files that had changes rather than the loop it does now on all files. Once the save module is more robust I'll implement message dialogs for the IOErrors.

I've not heard of sets before, would you care to explain a bit more of what it is?

I'm not too sure what I want to do about the interface, whether I want to keep it how it is now, or split it into two panes as you mentioned. Though I wonder how I would the be able to drag a file from one file to another in a specific spot.. maybe a signal I can capture to switch what view is present.. I don't know. I have not coded a two pane interface before. (although I'm planning to the data and view code in seperate script files soon, which will help me in the UI department greatly when I know I won't break the backend)
_________________
!snack
Back to top
View user's profile Send private message
dol-sen
Developer
Developer


Joined: 30 Jun 2002
Posts: 2805
Location: Richmond, BC, Canada

PostPosted: Fri Dec 28, 2007 8:41 am    Post subject: Reply with quote

Sets are groups of packages for whatever reason you want connected together. Examples are "System" and "World" which are special package sets that portage can perform operations on. Another example would be gnome-base/gnome which is a meta package. It has no program/code of it's own but has lists all the base gnome programs as it's dependencies as a convenience for us to use. It creates other problems such as trying to unmerge all the dependencies if you decide not to use gnome anymore. It would be much better to have a file (set) listing all the packages you would like to include for your gnome desktop and have portage/pkgcore/paludis perform operations on only that set of apps.

Also a coding tip: It will be easier to make changes later if you declare some global variables/constants at the beginning of the script (or separate script, and import them) then use them in your code. It makes life a lot easier to make changes later.

an expample I pulled from porthole's trunk/db/user_configs.py
Code:
CONFIG_TYPES = ['USE', 'KEYWORDS', 'MASK', 'UNMASK', 'SETS']
CONFIG_FILES = ['package.use', 'package.keywords', 'package.mask', 'package.unmask', 'sets']


# then later in the code

    def __init__(self, go):
        utils.debug.dprint("USER_CONFIGS: __init__()")
        # main index files
        self.db = {}
        self.sources = {}
        for mytype in CONFIG_TYPES:
            self.db[mytype] = {}
            self.sources[mytype] = {}
        for file in CONFIG_FILES:
            utils.debug.dprint("USER_CONFIGS: __init__(); file = " + file)
            self.load(os.path.join(portage_lib.user_config_dir,file))


As well as other places that I use the CONFIG_* constants. Adding a new type and file/dir name is a one place edit. No need to search thru the code and redo it each place. Porthole's user_configs.py is probably way more involved and complex than you need but may give you some ideas on how to do some things you may want to do. This code is to read in all the relevant files and create an in memory database for porthole to search for any and all occurrences of category/package in any of the files to display that info about that package. This is from porthole's cvs version. If you haven't tried it, then try it. it is much better than the one in the tree, a few things to finish though, but better.


For (complex) examples of 2 panes of info for display, look over trunk/mainwindow.py, and in trunk/views/ -- commontreeview.py, category.py, package.py
_________________
Brian
Porthole, the Portage GUI frontend irc@freenode: #gentoo-guis, #porthole, Blog
layman, gentoolkit, CoreBuilder, esearch...
Back to top
View user's profile Send private message
Ken69267
Developer
Developer


Joined: 08 Apr 2007
Posts: 111
Location: #gentoo-pr0n

PostPosted: Sun Dec 30, 2007 4:41 pm    Post subject: Reply with quote

heh, seems I left alot of bugs in this alpha. allwell, it was an alpha :wink:

I decided to do the Dual Panel view and it seems to be working out pretty well. Double clicking an entry in the left panel brings up the contents in the right panel. As of now in the svn that's about all of its functionality with the new view. (working on fixing everything now.. Drag and Drop got busted with the mirgration of views)

I took your advice and declared/imported some global variables to make it easier (such as the portage path..makes for easy switching from my test directory to the real one for a commit)

I've split my code into modules now, although it's pretty messy atm and I'm not sure if I'll keep some or rename them.

I also finally updated my svn repo on gna.org to match that of my git repo, so you can check out the latest progress now. Also, I think all my tasks are public now on gna :P

One thing I wanted to ask, is sets a file, or a directory, or can it be both? (I assume it's /etc/portage/sets for all package managers?)
_________________
!snack
Back to top
View user's profile Send private message
dol-sen
Developer
Developer


Joined: 30 Jun 2002
Posts: 2805
Location: Richmond, BC, Canada

PostPosted: Mon Dec 31, 2007 8:22 am    Post subject: Reply with quote

Here are the changes I made to your alpha release. I'm glad it is available on svn now. It was blank the other day that I tried. And yes, the "sets" is a directory of text files containing lists of packages with qualifying syntax similar to package.mask and package.unmask
Quote:
=app-misc/lirc-0.8.0
dev-util/devhelp


Code:
      self.files = ['package.keywords', 'package.unmask', 'package.mask', 'package.use', 'sets']


   def create_treeiter(self):#create the parent/main rows
      parent_folder, simple_files = self.folder_scan()
      #parent_files = self.folder_walk(parent_folder)
      for i in simple_files: #needs no sub main rows just data
         if 'package.' in i:
            name = i.partition('.')[2]
         else:
            name = i
         siter = name+"_iter"
         siter = self.datastore.append(None, [name, None, False])
         data = self.scan_contents(i)
         for row in data:
            col1 = row[0].rstrip() #strips \n
            try:
               col2 = row[1].rstrip() # not all files have 2 cols
            except:
               col2 = None
            self.datastore.append(siter, [col1, col2, True])
      for i in parent_folder: #parent_folders is list of folders such as package.keywords
         #i is a dir such as package.keywords
         pfolder = i
         if 'package.' in i:
            name = i.partition('.')[2]
         else:
            name = i
         #name = i.partition('.')[2]
         giter = name+"_iter"
         giter = self.datastore.append(None, [name, None, False])
         complex_files = self.folder_walk(i) #this needs to return list files in dir
         for i in complex_files: #"simple files"
            name = i #folder name being iterated
            gciter = name+"_iter"
            gciter = self.datastore.append(giter, [name, None, False])
            dir_file_path = pfolder+'/'+i
            data = self.scan_contents(dir_file_path)
            for row in data:
               col1 = row[0].rstrip()
               try:
                  col2 = row[1].rstrip()
               except:
                  col2 = None
               self.datastore.append(gciter, [col1,col2, True])


Sorry, I was going to do a diff for you, but since you've done drastic changes you would have to hand edit it anyway. Or here is the code chunk by itself that was changed for the 2 spots where the name was split. I'll get your svn checkout and submit diff's for any changes/bugfixes I make.
Code:
         if 'package.' in i:
            name = i.partition('.')[2]
         else:
            name = i
         #name = i.partition('.')[2]


I also think it might be better to NOT partition the name like in the above code block since it is the actual file/directory name. Just use i for the name, the text width will be slightly wider but shouldn't be too wide. It might also help prevent the noobs from getting confused about the actual name.

I think you'll find the 2 pane display will work better in the long run. It should be easier to add syntax checking in the future as well (IF you wanted to add it)
_________________
Brian
Porthole, the Portage GUI frontend irc@freenode: #gentoo-guis, #porthole, Blog
layman, gentoolkit, CoreBuilder, esearch...
Back to top
View user's profile Send private message
Ken69267
Developer
Developer


Joined: 08 Apr 2007
Posts: 111
Location: #gentoo-pr0n

PostPosted: Mon Dec 31, 2007 3:45 pm    Post subject: Reply with quote

Yeah the splitting of the name was legacy code.. forgot why I did it that way anyway. I'll have that change commited in a few minutes, thanks again.
_________________
!snack
Back to top
View user's profile Send private message
Ken69267
Developer
Developer


Joined: 08 Apr 2007
Posts: 111
Location: #gentoo-pr0n

PostPosted: Sat Apr 05, 2008 4:20 pm    Post subject: Reply with quote

For anyone still interested, gpytage-0.2.0_beta2 was released about a week ago, and it's really starting to be usable. It still has some design issues and general faults, but I'm working on ironing those out.

Users can grab an ebuild here.

As always, the main project site for it is on gna.org.
_________________
!snack
Back to top
View user's profile Send private message
Ken69267
Developer
Developer


Joined: 08 Apr 2007
Posts: 111
Location: #gentoo-pr0n

PostPosted: Fri Jun 06, 2008 2:05 am    Post subject: Reply with quote

GPytage 0.2.0 RC1 was released a few days ago, and is now in the portage tree.
_________________
!snack
Back to top
View user's profile Send private message
Necoro
Veteran
Veteran


Joined: 18 Dec 2005
Posts: 1912
Location: München (Germany)

PostPosted: Tue Jun 10, 2008 11:45 am    Post subject: Reply with quote

Added gpytage as a plugin for Portato :)
Will be in portato's next release
_________________
Inter Deum Et Diabolum Semper Musica Est.
Back to top
View user's profile Send private message
MikeyG
n00b
n00b


Joined: 25 Jan 2014
Posts: 7

PostPosted: Fri Sep 18, 2020 12:00 am    Post subject: Gpytage Reply with quote

An old app, worked only with python 2.7. Since I used it once and awhile, I decided to convert to python 3.7 and Gtk3.

https://gitlab.com/mikeos2/gpytage

Mike
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum