Add files via upload

This commit is contained in:
Lerking
2018-02-21 14:02:02 +01:00
committed by GitHub
parent d7b4b3654e
commit 0a3a0105fe

112
Gui test/gtk_test_1.py Normal file
View File

@@ -0,0 +1,112 @@
#!/usr/bin/env python3.5
# You are free to use and/or change this code for
# your own needs.
# Original code (c)2018 Jan Lerking
# Program to convert C-header (*.h) files to nasm include files (*.inc),
# for direct usage in assembly programming using nasm/yasm.
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
class h2incGUI(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self)
self.set_title('Translate C-header files to Nasm include files!')
self.set_default_size(200, 200)
self.set_border_width(5)
self.connect("destroy", Gtk.main_quit)
self.sourcedir = 'Select source directory!'
self.destdir = 'Select destination directory!'
self.addinc = False
self.totalvar = 0
self.filecnt = 0
self.infofolder = 'Number of folders: 0'
self.infofile = 'Number of headers: 0'
self.currentfile = 'Current file: '
self.totprogress = 'Total progress: '
self.val = 0
self.maingrid = Gtk.Grid()
self.add(self.maingrid)
self.frame = Gtk.Frame(label='Select folders')
self.maingrid.add(self.frame)
self.framegrid = Gtk.Grid()
self.frame.add(self.framegrid)
self.sourcelabel = Gtk.Label(label='Source: ')
self.framegrid.attach(self.sourcelabel, 1, 1, 1, 1)
self.sourceentry = Gtk.Entry()
self.sourceentry.set_text(self.sourcedir)
self.framegrid.attach(self.sourceentry, 2, 1, 1, 1)
self.sourcedir_button = Gtk.Button(label="Source directory...")
#self.sourcedir_button.connect('clicked', self.select_sourcedir(self.sourcedir))
self.framegrid.attach(self.sourcedir_button, 3, 1, 1, 1)
self.destbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=6)
self.framegrid.attach(self.destbox, 1, 2, 1, 1)
self.destlabel = Gtk.Label(label='Destination: ')
self.framegrid.attach(self.destlabel, 2, 2, 1, 1)
self.destentry = Gtk.Entry()
self.destentry.set_text(self.destdir)
#self.destbox.add(self.destentry)
self.destdir_button = Gtk.Button(label="Destination directory...")
#self.destdir_button.connect('clicked', self.select_destdir(self.destdir))
#self.destbox.add(self.destdir_button)
self.incchkbox = Gtk.CheckButton('Create "include" folder if it does not exist.')
self.incchkbox.set_active(False)
#self.incchkbox.connect("toggled", self.on_button_toggled, self.addinc)
#self.framebox.add(self.incchkbox)
self.transframe = Gtk.Frame(label='Translation')
#self.mainbox.add(self.transframe)
self.framebox_1 = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
#self.transframe.add(self.framebox_1)
self.infoframe = Gtk.Frame(label='Source information')
#self.framebox_1.add(self.infoframe)
self.infobox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
#self.infoframe.add(self.infobox)
self.infofolders = Gtk.Label(label=self.infofolder)
#self.infobox.add(self.infofolders)
self.infofiles = Gtk.Label(label=self.infofile)
#self.infobox.add(self.infofiles)
self.translate_button = Gtk.Button(label="Translate!")
#self.translate_button.connect('clicked', self.translate(self.destdir, self.sourcedir, self.addinc))
#self.framebox_1.add(self.translate_button)
self.progressframe = Gtk.Frame(label='Progress')
#self.framebox_1.add(self.progressframe)
self.progressbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
#self.progressframe.add(self.progressbox)
self.cfilelabel = Gtk.Label(label=self.currentfile)
#self.progressbox.add(self.cfilelabel)
self.totallabel = Gtk.Label(label=self.totprogress)
#self.progressbox.add(self.totallabel)
self.totalprogress = Gtk.ProgressBar()
self.totalprogress.set_fraction(0.0)
#self.progressbox.add(self.totalprogress)
win = h2incGUI()
win.show_all()
Gtk.main()