Fix imports, apply black

This commit is contained in:
Roberto Alsina 2024-06-03 11:38:36 -03:00
parent ab8644b9ec
commit d038fcd217
7 changed files with 1056 additions and 792 deletions

File diff suppressed because it is too large Load Diff

View File

@ -5,12 +5,12 @@ from Pyxform import *
# Init the library (sucks but works) # Init the library (sucks but works)
# #
xfinit ('Something','1',sys.argv[0]) xfinit("Something", "1", sys.argv[0])
# #
# Create a "Window" - A form in XForms parlance # Create a "Window" - A form in XForms parlance
win=Form() win = Form()
# #
# Show it # Show it
@ -20,15 +20,15 @@ win.Show()
# #
# Create a button # Create a button
a_button=Button(0,10,10,100,30,"Press Me") a_button = Button(0, 10, 10, 100, 30, "Press Me")
# #
# Put it inside win # Put it inside win
win.Add (a_button) win.Add(a_button)
# #
# Start the event loop # Start the event loop
# It will run forever, because the button doesn't do anything # It will run forever, because the button doesn't do anything
runforms() runforms()

View File

@ -7,12 +7,12 @@ from goodies import *
# Init the library (sucks but works) # Init the library (sucks but works)
# #
xfinit ('Something','1',sys.argv[0]) xfinit("Something", "1", sys.argv[0])
# #
# Create a "Window" - A form in XForms parlance # Create a "Window" - A form in XForms parlance
win=Form() win = Form()
# #
# Show it # Show it
@ -22,30 +22,32 @@ win.Show()
# #
# Create a button # Create a button
a_button=Button(0,10,10,100,30,"Press Me") a_button = Button(0, 10, 10, 100, 30, "Press Me")
# #
# Put it inside win # Put it inside win
win.Add (a_button) win.Add(a_button)
# #
# Define a function, that will be executed when the button is pressed # Define a function, that will be executed when the button is pressed
def funct (self):
# It shows a message and exits (or not) def funct(self):
answer=show_question ("Do you want","to exit?","") # It shows a message and exits (or not)
if answer==1: answer = show_question("Do you want", "to exit?", "")
sys.exit() if answer == 1:
sys.exit()
# #
# And bind the function to the button # And bind the function to the button
a_button.cb=funct a_button.cb = funct
# #
# Start the event loop # Start the event loop
# It will run until you press the button and say yes # It will run until you press the button and say yes
runforms() runforms()

View File

@ -7,12 +7,12 @@ from goodies import *
# Init the library (sucks but works) # Init the library (sucks but works)
# #
xfinit ('Something','1',sys.argv[0]) xfinit("Something", "1", sys.argv[0])
# #
# Create a "Window" - A form in XForms parlance # Create a "Window" - A form in XForms parlance
win=Form() win = Form()
# #
# Show it # Show it
@ -22,54 +22,56 @@ win.Show()
# #
# Create a button, and 2 sliders # Create a button, and 2 sliders
a_button=Button(0,10,10,100,30,"Press Me") a_button = Button(0, 10, 10, 100, 30, "Press Me")
h_slider=Slider(5,0,180,200,20,"") h_slider = Slider(5, 0, 180, 200, 20, "")
v_slider=Slider(4,180,0,20,180,"") v_slider = Slider(4, 180, 0, 20, 180, "")
# #
# Set some values for the sliders # Set some values for the sliders
h_slider.Setbounds(0,200) h_slider.Setbounds(0, 200)
h_slider.Set(0) h_slider.Set(0)
v_slider.Setbounds(0,200) v_slider.Setbounds(0, 200)
v_slider.Set(0) v_slider.Set(0)
# #
# Put them inside win # Put them inside win
win.Add (a_button) win.Add(a_button)
win.Add (h_slider) win.Add(h_slider)
win.Add (v_slider) win.Add(v_slider)
# #
# Define a function, that will be executed when the button is pressed # Define a function, that will be executed when the button is pressed
def funct (self):
# It shows a message and exits (or not) def funct(self):
answer=show_question ("Do you want","to exit?","") # It shows a message and exits (or not)
if answer==1: answer = show_question("Do you want", "to exit?", "")
sys.exit() if answer == 1:
sys.exit()
# #
# And another one, for when the sliders move # And another one, for when the sliders move
def slide (self):
# It moves the button to the position of the sliders
a_button.x=h_slider.Get()
a_button.y=v_slider.Get()
def slide(self):
# It moves the button to the position of the sliders
a_button.x = h_slider.Get()
a_button.y = v_slider.Get()
# #
# And bind the functions to the controls # And bind the functions to the controls
a_button.cb=funct a_button.cb = funct
h_slider.cb=v_slider.cb=slide h_slider.cb = v_slider.cb = slide
# #
# Start the event loop # Start the event loop
# It will run until you press the button and say yes # It will run until you press the button and say yes
runforms() runforms()

View File

@ -7,12 +7,12 @@ from goodies import *
# Init the library (sucks but works) # Init the library (sucks but works)
# #
xfinit ('Something','1',sys.argv[0]) xfinit("Something", "1", sys.argv[0])
# #
# Create a "Window" - A form in XForms parlance # Create a "Window" - A form in XForms parlance
win=Form() win = Form()
# #
# Show it # Show it
@ -22,56 +22,58 @@ win.Show()
# #
# Create a button, and 2 valsliders # Create a button, and 2 valsliders
a_button=Button(0,10,10,100,30,"Press Me") a_button = Button(0, 10, 10, 100, 30, "Press Me")
h_slider=Valslider(5,0,180,200,20,"") h_slider = Valslider(5, 0, 180, 200, 20, "")
v_slider=Valslider(4,180,0,20,180,"") v_slider = Valslider(4, 180, 0, 20, 180, "")
# #
# Set some values for the sliders # Set some values for the sliders
h_slider.Setbounds(0,200) h_slider.Setbounds(0, 200)
h_slider.Set(0) h_slider.Set(0)
h_slider.Setprecision(0) h_slider.Setprecision(0)
v_slider.Setbounds(0,200) v_slider.Setbounds(0, 200)
v_slider.Set(0) v_slider.Set(0)
v_slider.Setprecision(0) v_slider.Setprecision(0)
# #
# Put them inside win # Put them inside win
win.Add (a_button) win.Add(a_button)
win.Add (h_slider) win.Add(h_slider)
win.Add (v_slider) win.Add(v_slider)
# #
# Define a function, that will be executed when the button is pressed # Define a function, that will be executed when the button is pressed
def funct (self):
# It shows a message and exits (or not) def funct(self):
answer=show_question ("Do you want","to exit?","") # It shows a message and exits (or not)
if answer==1: answer = show_question("Do you want", "to exit?", "")
sys.exit() if answer == 1:
sys.exit()
# #
# And another one, for when the sliders move # And another one, for when the sliders move
def slide (self):
# It moves the button to the position of the sliders
a_button.x=h_slider.Get()
a_button.y=v_slider.Get()
def slide(self):
# It moves the button to the position of the sliders
a_button.x = h_slider.Get()
a_button.y = v_slider.Get()
# #
# And bind the functions to the controls # And bind the functions to the controls
a_button.cb=funct a_button.cb = funct
h_slider.cb=v_slider.cb=slide h_slider.cb = v_slider.cb = slide
# #
# Start the event loop # Start the event loop
# It will run until you press the button and say yes # It will run until you press the button and say yes
runforms() runforms()

View File

@ -7,12 +7,12 @@ from goodies import *
# Init the library (sucks but works) # Init the library (sucks but works)
# #
xfinit ('Something','1',sys.argv[0]) xfinit("Something", "1", sys.argv[0])
# #
# Create a "Window" - A form in XForms parlance # Create a "Window" - A form in XForms parlance
win=Form(6,640,480) win = Form(6, 640, 480)
# #
# Show it # Show it
@ -22,35 +22,40 @@ win.Show()
# #
# Create a browser and a Button # Create a browser and a Button
brow=Browser(0,10,10,620,440,"Read Me") brow = Browser(0, 10, 10, 620, 440, "Read Me")
but1=Button (0,10,450,100,25,"Push Me") but1 = Button(0, 10, 450, 100, 25, "Push Me")
but2=Button (0,120,450,100,25,"Exit") but2 = Button(0, 120, 450, 100, 25, "Exit")
# #
# Put them inside win # Put them inside win
win.Add (brow) win.Add(brow)
win.Add (but1) win.Add(but1)
win.Add (but2) win.Add(but2)
# #
# The exit function # The exit function
def funct (self):
# It shows a message and exits (or not) def funct(self):
answer=show_question ("Do you want","to exit?","") # It shows a message and exits (or not)
if answer==1: answer = show_question("Do you want", "to exit?", "")
sys.exit() if answer == 1:
but2.cb=funct sys.exit()
but2.cb = funct
# #
# And the interesting function # And the interesting function
def browse_file(self):
# Asks for a file, and puts it in the browser
filename=show_fselector("","","","")
brow.Load (filename)
but1.cb=browse_file def browse_file(self):
# Asks for a file, and puts it in the browser
filename = show_fselector("", "", "", "")
brow.Load(filename)
but1.cb = browse_file
# #

260
setup.py
View File

@ -1,99 +1,167 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from setuptools import setup, Extension from setuptools import setup, Extension
bitmaps = Extension('Pyxform.bitmaps', bitmaps = Extension(
sources = [ 'Pyxform/Modules/bitmaps.c'], "Pyxform.bitmaps",
libraries = ['forms'], sources=["Pyxform/Modules/bitmaps.c"],
library_dirs = ['/usr/local/lib']) libraries=["forms"],
box = Extension('Pyxform.box', library_dirs=["/usr/local/lib"],
sources = [ 'Pyxform/Modules/box.c'], )
libraries = ['forms'], box = Extension(
library_dirs = ['/usr/local/lib']) "Pyxform.box",
browser = Extension('Pyxform.browser', sources=["Pyxform/Modules/box.c"],
sources = [ 'Pyxform/Modules/browser.c'], libraries=["forms"],
libraries = ['forms'], library_dirs=["/usr/local/lib"],
library_dirs = ['/usr/local/lib']) )
button = Extension('Pyxform.button', browser = Extension(
sources = [ 'Pyxform/Modules/button.c'], "Pyxform.browser",
libraries = ['forms'], sources=["Pyxform/Modules/browser.c"],
library_dirs = ['/usr/local/lib']) libraries=["forms"],
choice = Extension('Pyxform.choice', library_dirs=["/usr/local/lib"],
sources = [ 'Pyxform/Modules/choice.c'], )
libraries = ['forms'], button = Extension(
library_dirs = ['/usr/local/lib']) "Pyxform.button",
clock = Extension('Pyxform.clock', sources=["Pyxform/Modules/button.c"],
sources = [ 'Pyxform/Modules/clock.c'], libraries=["forms"],
libraries = ['forms'], library_dirs=["/usr/local/lib"],
library_dirs = ['/usr/local/lib']) )
counter = Extension('Pyxform.counter', choice = Extension(
sources = [ 'Pyxform/Modules/counter.c'], "Pyxform.choice",
libraries = ['forms'], sources=["Pyxform/Modules/choice.c"],
library_dirs = ['/usr/local/lib']) libraries=["forms"],
dial = Extension('Pyxform.dial', library_dirs=["/usr/local/lib"],
sources = [ 'Pyxform/Modules/dial.c'], )
libraries = ['forms'], clock = Extension(
library_dirs = ['/usr/local/lib']) "Pyxform.clock",
forms = Extension('Pyxform.forms', sources=["Pyxform/Modules/clock.c"],
sources = [ 'Pyxform/Modules/forms.c'], libraries=["forms"],
libraries = ['forms'], library_dirs=["/usr/local/lib"],
library_dirs = ['/usr/local/lib']) )
frame = Extension('Pyxform.frame', counter = Extension(
sources = [ 'Pyxform/Modules/frame.c'], "Pyxform.counter",
libraries = ['forms'], sources=["Pyxform/Modules/counter.c"],
library_dirs = ['/usr/local/lib']) libraries=["forms"],
goodies = Extension('Pyxform.goodies', library_dirs=["/usr/local/lib"],
sources = [ 'Pyxform/Modules/goodies.c'], )
libraries = ['forms'], dial = Extension(
library_dirs = ['/usr/local/lib']) "Pyxform.dial",
input = Extension('Pyxform.input', sources=["Pyxform/Modules/dial.c"],
sources = [ 'Pyxform/Modules/input.c'], libraries=["forms"],
libraries = ['forms'], library_dirs=["/usr/local/lib"],
library_dirs = ['/usr/local/lib']) )
menu = Extension('Pyxform.menu', forms = Extension(
sources = [ 'Pyxform/Modules/menu.c'], "Pyxform.forms",
libraries = ['forms'], sources=["Pyxform/Modules/forms.c"],
library_dirs = ['/usr/local/lib']) libraries=["forms"],
objects = Extension('Pyxform.objects', library_dirs=["/usr/local/lib"],
sources = [ 'Pyxform/Modules/objects.c'], )
libraries = ['forms'], frame = Extension(
library_dirs = ['/usr/local/lib']) "Pyxform.frame",
pixmaps = Extension('Pyxform.pixmaps', sources=["Pyxform/Modules/frame.c"],
sources = [ 'Pyxform/Modules/pixmaps.c'], libraries=["forms"],
libraries = ['forms'], library_dirs=["/usr/local/lib"],
library_dirs = ['/usr/local/lib']) )
popups = Extension('Pyxform.popups', goodies = Extension(
sources = [ 'Pyxform/Modules/popups.c'], "Pyxform.goodies",
libraries = ['forms'], sources=["Pyxform/Modules/goodies.c"],
library_dirs = ['/usr/local/lib']) libraries=["forms"],
positioner = Extension('Pyxform.positioner', library_dirs=["/usr/local/lib"],
sources = [ 'Pyxform/Modules/positioner.c'], )
libraries = ['forms'], input = Extension(
library_dirs = ['/usr/local/lib']) "Pyxform.input",
slider = Extension('Pyxform.slider', sources=["Pyxform/Modules/input.c"],
sources = [ 'Pyxform/Modules/slider.c'], libraries=["forms"],
libraries = ['forms'], library_dirs=["/usr/local/lib"],
library_dirs = ['/usr/local/lib']) )
text = Extension('Pyxform.text', menu = Extension(
sources = [ 'Pyxform/Modules/text.c'], "Pyxform.menu",
libraries = ['forms'], sources=["Pyxform/Modules/menu.c"],
library_dirs = ['/usr/local/lib']) libraries=["forms"],
timer = Extension('Pyxform.timer', library_dirs=["/usr/local/lib"],
sources = [ 'Pyxform/Modules/timer.c'], )
libraries = ['forms'], objects = Extension(
library_dirs = ['/usr/local/lib']) "Pyxform.objects",
xforms = Extension('Pyxform.xforms', sources=["Pyxform/Modules/objects.c"],
sources = [ 'Pyxform/Modules/xforms.c'], libraries=["forms"],
libraries = ['forms'], library_dirs=["/usr/local/lib"],
library_dirs = ['/usr/local/lib']) )
xyplot = Extension('Pyxform.xyplot', pixmaps = Extension(
sources = [ 'Pyxform/Modules/xyplot.c'], "Pyxform.pixmaps",
libraries = ['forms'], sources=["Pyxform/Modules/pixmaps.c"],
library_dirs = ['/usr/local/lib']) libraries=["forms"],
setup (name = 'PyXForms', library_dirs=["/usr/local/lib"],
version = '0.2', )
description = 'This is OLD code', popups = Extension(
author = 'Roberto Alsina', "Pyxform.popups",
author_email = 'ralsina@netmanagers.com.ar', sources=["Pyxform/Modules/popups.c"],
ext_modules = [bitmaps, box, browser, button, choice, clock, counter, dial, forms, frame, goodies, input, menu, objects, pixmaps, popups, positioner, slider, text, timer, xforms, xyplot], libraries=["forms"],
packages = ['Pyxform'] library_dirs=["/usr/local/lib"],
) )
positioner = Extension(
"Pyxform.positioner",
sources=["Pyxform/Modules/positioner.c"],
libraries=["forms"],
library_dirs=["/usr/local/lib"],
)
slider = Extension(
"Pyxform.slider",
sources=["Pyxform/Modules/slider.c"],
libraries=["forms"],
library_dirs=["/usr/local/lib"],
)
text = Extension(
"Pyxform.text",
sources=["Pyxform/Modules/text.c"],
libraries=["forms"],
library_dirs=["/usr/local/lib"],
)
timer = Extension(
"Pyxform.timer",
sources=["Pyxform/Modules/timer.c"],
libraries=["forms"],
library_dirs=["/usr/local/lib"],
)
xforms = Extension(
"Pyxform.xforms",
sources=["Pyxform/Modules/xforms.c"],
libraries=["forms"],
library_dirs=["/usr/local/lib"],
)
xyplot = Extension(
"Pyxform.xyplot",
sources=["Pyxform/Modules/xyplot.c"],
libraries=["forms"],
library_dirs=["/usr/local/lib"],
)
setup(
name="PyXForms",
version="0.2",
description="This is OLD code",
author="Roberto Alsina",
author_email="ralsina@netmanagers.com.ar",
ext_modules=[
bitmaps,
box,
browser,
button,
choice,
clock,
counter,
dial,
forms,
frame,
goodies,
input,
menu,
objects,
pixmaps,
popups,
positioner,
slider,
text,
timer,
xforms,
xyplot,
],
packages=["Pyxform"],
)