• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Overclockix Custom App requests

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.
Awesome work! Working great on my laptop. Definitely adding this to the next build :thup:

Also, turns out that vB doesn't like extensions that have multiple extensions (like tar.gz) so I've removed the .tar.gz option in favor of the .tgz archive type since it is the same, just named differently
 
I will finish the i386 tomorrow.

The Shred front end is coming along, I suspect that it will be done by the end of the weekend *fingers crossed*
 
Here is the beta code for the frontend for shred as requested

Code:
#!/usr/bin/env python
import gtk
import pygtk
import gobject
import os
import sys
import re
import getpass
import gtk.glade
import time

#Get the list of available drives even if they are not mounted
os.popen("sudo file -sL /dev/sd* > /tmp/somefile").read()
drive_list = open("/tmp/somefile").readlines()
#We initialize the lists so that we can link them together later
#in the liststore
filesystem = []
device = []
used = []
total = []
free = []

class createUI:
####################               
    #This function is linked to the timer. It updates the progress bar based on the interval
    #specified as a parameter of the timer variable
    def progress_timeout(self):
            global percent 
            #Tail the file and start parsing out the percentage complete
            shredding_progress = os.popen("tail -n 1 /tmp/shred.txt").read()
            try:
                shredding_progress = shredding_progress.split(" ")
                drive = shredding_progress[1].rstrip()
                shredding_progress = shredding_progress[5].replace("%", "")
                
                percent_text = shredding_progress.rstrip()
                shredding_progress = float(shredding_progress)/100
                #Percentages are float point integers so anything over than 1
                # will reset the bar
                if shredding_progress >= 1.0:
                    self.progress.set_text(" %s has been completely shredded" % (drive,))
                    self.progress.set_fraction(0.0)
                    return False
                else:
                    self.progress.set_fraction(shredding_progress)
                    self.progress.set_text(" %s is  %s %s shredded" % (drive, percent_text, "%"))
                    return True
            except:
                return True
####################### 
    def shred_selected(self):
            #This function determines which field has been selected
            #Then it picks the package name from the second column 
            self.selection = treeview.get_selection()
            self.selection.set_mode(gtk.SELECTION_SINGLE)
            tree_model, tree_iter = self.selection.get_selected()
            #The line below is the line which determines which column is passed to the installer
            selected_program = tree_model.get_value(tree_iter, 0)    
            os.system("python shred_test.py %s &" % selected_program)
            time.sleep(0.3)
########################
    #This is the event which is called from the button click
    #It launches the timer and starts the shredding process            
    def launch(self, click):
        self.shred_selected()
        timer = gobject.timeout_add(300, self.progress_timeout)

##################################
    def kill_program(self, click):
        #attempt to clean up before quitting
        os.system('rm -rf /tmp/shred.txt')
        gtk.main_quit()
#################################
    def __init__(self):
        self.createTable(None)
#################################
    #This function gets the disk usage by mounting disks, getting df output and then unmounting the disks
    def get_disk_usage(self, disk):
        os.popen("sudo mount %s /mnt" % disk).read()
        total.append(os.popen("df -H |grep 'mnt' | awk '{print $2}'").read())
        used.append(os.popen("df -H |grep 'mnt' |awk '{print $3}'").read())
        free.append(os.popen("df -H |grep 'mnt' |awk '{print $4}'").read())
        os.system("sudo umount /mnt")
#############################
    #This makes sure that all of the list elements line up properly
    #by adding blanks for information which cannot be gathered
    def append_blank(self):
        total.append("")
        used.append("")
        free.append("")
############################
    def get_disk_info(self):
        #step through the drive list
        for line in drive_list:
            disk = line.split(":")
            disk = disk[0]
            #If we encounter a block device which isnt a partition append it
            if re.match("^[A-Za-z/]*$", disk):
                device.append(disk)
            #We want to visually distinguish the partitions from the block device so add spaces
            else:
                disk_indent = "        ", disk
                disk_indent = "".join(disk_indent)
                device.append(disk_indent)            
            #I want to eliminate the block devices such as /dev/sda
            if re.match("^[A-Za-z/]*$", disk):
                filesystem.append("")
                self.append_blank()
            #Extended partitions also through off the parsing so handle them seperately    
            elif "ID=0x5" in line:
                filesystem.append("Extended Partition")
                self.append_blank()
            #Note the swap space
            elif "swap" in line:
                filesystem.append("Swap space")
                self.append_blank()
            #Linux puts its filesystem type at a different location then NTFS drives so we need to treat them seperately    
            elif "Linux" in line:
                   line = line.split(" ")
                   #line = "        ", line[4]
                   #line = "".join(line)
                   filesystem.append(line[4])
                   self.get_disk_usage(disk)
            #If there are Windows partitions on the drive find them
            #Their drive information is at different element locations than the linux drives
            elif "NTFS" in line:
                   line = line.split(" ")
                   line = line[8].replace('"', "")
                   filesystem.append(line)
                   self.get_disk_usage(disk)
            
            #This is to handle misc filesystems such as DOS executable (device driver)
            else:
                filesystem.append("???") 
                self.append_blank()
        
        counter = 0
        #This loop matches all of the lists together
        while counter < len(device):
            self.treestore.append(
                            [ device[counter], filesystem[counter], used[counter], free[counter],total[counter], "" ]
                            )
            counter +=1

#####################3        
    def createTable(self, blank):
        #Most of this work was done inside of glade
        global treeview
        #get the builder object so that we can interact with the glade component
        self.builder = gtk.Builder()
        self.builder.add_from_file('shred_ui.glade')
        self.builder.connect_signals(self)
        self.progress = self.builder.get_object('progress')
        self.aptitude_results = self.builder.get_object('window')
        treeview = self.builder.get_object('treeview')
        table_vbox = self.builder.get_object('vbox')

        self.treestore = self.builder.get_object('liststore')
        
        cols = ["Device","Filesystem Type","Used","Free", "Total"]
        treeview.cell = [None] * len(cols)
        treeview_column = [None] * len(cols)

        for column_number, col in enumerate(cols):
            treeview.cell[column_number] = gtk.CellRendererText()
            treeview_column[column_number] = gtk.TreeViewColumn(col, treeview.cell[column_number])
            treeview_column[column_number].add_attribute(treeview.cell[column_number], 'text', column_number)
            treeview_column[column_number].set_resizable(True)
            treeview_column[column_number].set_reorderable(True)
            treeview_column[column_number].set_sort_indicator(True)
            treeview_column[column_number].set_sort_column_id(column_number)
            treeview.append_column(treeview_column[column_number])
        
        self.get_disk_info()
       
        #add the tool bar for 'nice' buttons
        toolbar = self.builder.get_object('toolbar')
		
		#quit button
        quit_icon = gtk.Image()
        quit_icon.set_from_file("/root/.tux_search/icons/quit.png")
        quit_button = gtk.ToolButton(label="Quit!", icon_widget=quit_icon)
        toolbar.insert(quit_button, 0)
        quit_button.connect("clicked", self.kill_program)
        
        #uninstall button
        shred_icon = gtk.Image()
        shred_icon.set_from_file("/root/.tux_search/icons/uninstall.png")
        shred_button = gtk.ToolButton(label="Shred!", icon_widget=shred_icon)
        toolbar.insert(shred_button, 0)
        shred_button.connect("clicked", self.launch)
        
        toolbar.show()

        table_vbox.show()
        self.aptitude_results.connect("destroy", lambda w: gtk.main_quit())
        self.aptitude_results.set_default_size(600, 500)
        self.aptitude_results.set_position(gtk.WIN_POS_CENTER)
        self.aptitude_results.show_all()
        gtk.main()
if __name__ == "__main__":
    createUI()
    #cleanup the temp files
    os.system("rm -rf /tmp/somefile")
    os.system("rm -rf /tmp/shred.txt")

glade and images are attached
 

Attachments

  • uninstall.png
    uninstall.png
    20.3 KB · Views: 49
  • quit.png
    quit.png
    15.7 KB · Views: 48
  • shred_ui.tar.gz
    672 bytes · Views: 27
Here is the 64 bit binary, with the setup.py

same as before. Run python setup.py from within the folder where it is located

For whatever reason in my tests, the shredder icon sometimes worked and sometimes didnt

BE WARNED this is a BETA program, it assumes that you know what you are doing, if you hit the shred button IT WILL DESTROY YOUR DRIVE

Since there are a lot of the same shared libraries between this and the apt front end my next step is going to be dumping the libraries in the same spot and then sym linking to them to save space....

Thats for tomorrow...
and if i ever get around to 32 bit builds...

EDIT: Added confirmation dialog box so it wont shred automatically, corrected typoo in the .desktop file
 

Attachments

  • shred_in_action.png
    shred_in_action.png
    19.1 KB · Views: 52
  • shred_menu.png
    shred_menu.png
    30.1 KB · Views: 49
  • shred_gui_64.tar.gz
    3.4 MB · Views: 31
Last edited:
that's cool, I will give it a go on a spare machine I have, its been in the shed for the last few months drives are already wiped so no risk of data loss.

do you have a screen shot of it?
 
Installed fine on my laptop. Found one small typo... in the shred_gui.desktop file, the program icon is listed as 'Icon=/opt/shred/shredder.svn' instead of 'Icon=/opt/shred/shredder.svg'
 
ah thanks for that I will get screen shots and re-up the file shortly

may even get to doing 32 bit builds as well ;)
 
Made the changes, posted screen shots, added basic yes/no dialogue box before shredding commences

I may change the icons in a later release. Also I am not a greate GUI designer so if someone has a better idea for layouts I can try to work with that
 
Here is the 32 bit version of shred
 

Attachments

  • shred_gui_32.tar.gz
    3 MB · Views: 31
and the 32 bit version of the apt front end

Also attaching the source code
 

Attachments

  • aptitude_source.tar.gz
    3 MB · Views: 23
  • aptitude_32.tar.gz
    2.5 MB · Views: 29
Good deal. I am creating a test build to make sure the install process of shred_gui and aptitude frontend works fine in the extras.sh scripts.

I am also going to be making a overclockix-dev build which will include whatever applications you would need to be installed to assist with development. It will include all typical Overclockix packages with the development packages on top of that.
 
I decided to replace the icons

find the new ones attached, just replace the icons that are in the shred folder(s) with these
 

Attachments

  • quit.png
    quit.png
    6.5 KB · Views: 45
  • uninstall.png
    uninstall.png
    17.1 KB · Views: 44
Alright. I've repacked the tar.gz archives to be used by the builder utils. I was able to modify them before the build completed so they'll be in the test builds I am making to check em out.
 
Ok I created a new folder to hold the .so files so that there is less duplication and thus smaller footprint

Replaced the icons in shred myself.

Its the setup.py file that does the magic
 

Attachments

  • aptitude_32.tar.gz
    2.5 MB · Views: 35
  • aptitude_64.tar.gz
    3 MB · Views: 25
and the shred files
 

Attachments

  • shred_gui_32.tar.gz
    2.9 MB · Views: 23
  • shred_gui_64.tar.gz
    3.4 MB · Views: 31
Nice find! I'm not really sure how that it works but it is a nice utility. I don't have a SB or BD to work with, nor the time to really dig into how it works.
 
Here is another extremely useful little program for realtime monitoring of the CPU Freq. It is called i7z.
http://code.google.com/p/i7z/

If you are having problems installing it in Ubuntu the author suggests this (it worked for me):

Code:
gcc  -g -O0 -fomit-frame-pointer -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DBUILD_MAIN -Wall -Dx64_BIT -lpthread  i7z.c helper_functions.c i7z_Single_Socket.c  i7z_Dual_Socket.c -lncurses -lrt -o i7z
http://code.google.com/p/i7z/issues/detail?id=34

The picture shows a live kernel compilation in progress. Turbo-boost works and the window on the left shows it correctly.
 

Attachments

  • CPUfreq.png
    CPUfreq.png
    557.1 KB · Views: 39
Back