Last active
February 4, 2017 04:48
-
-
Save Crowbrammer/e3fc7fc39b440ba70f9515c4c321eac2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# File name: autopositioner.py | |
# #: import ListAdapter kivy.adapters.listadapter.ListAdapter | |
# #: import ListItemButton kivy.uix.listview.ListItemButton | |
AutoPositionerRoot: | |
<TestModule@BoxLayout>: | |
<MmpModule>: | |
size_hint: 1,1 | |
orientation: 'vertical' | |
id: mmpm1 | |
BoxLayout: # This should probably be in Root | |
id: bl_super | |
height: '90dp' | |
size_hint_y: None | |
padding: 10, 10 | |
BoxLayout: | |
pos1: position1 | |
pos2: position2 | |
pos3: position3 | |
orientation: 'vertical' | |
Button: | |
id: position1 | |
Button: | |
id: position2 | |
Button: | |
id: position3 | |
BoxLayout: | |
id: bl2 | |
orientation: 'vertical' | |
Button: | |
id: machine_button | |
Button: | |
id: model_button | |
<AutoPositionerRoot>: | |
orientation: 'vertical' | |
Image: | |
source: 'data/cat.jpg' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import libs.apa_database | |
import inspect | |
from kivy.app import App | |
from kivy.uix.boxlayout import BoxLayout | |
from kivy.properties import ObjectProperty, StringProperty, Property | |
#from kivy.uix.screenmanager import ScreenManager, Screen, FadeTransition | |
class AutoPositionerRoot(BoxLayout): | |
def __init__(self, **kwargs): | |
super(AutoPositionerRoot, self).__init__(**kwargs) | |
# for i in all_active_machines: | |
# check the model_in_the_machine | |
# check the positions required for the model_in_the_machine | |
# generate a tuple of positions ID's mach_model_pos | |
# for num_machines in machine_list: | |
# self.add_widget(MmpModule()) | |
# current_module_machine_name = machine_list[num_machine] | |
# current_module_model_name = dropdown_list_of_models | |
# list_view_thing = ready_to_be_updated | |
machine_list = libs.apa_database.get_data('machineID_modelID_status', order_by_column='machineID') | |
mmpm = [] | |
for i in range(0, len(machine_list)): | |
mmpm.append(MmpModule()) | |
print(len(machine_list)) | |
print('i = ' + str(i)) | |
mmpm[i].ids.machine_button.text = 'Wow: {}'.format(machine_list[i][0]) | |
mmpm[i].ids.model_button.text = 'Wow: {}'.format(machine_list[i][0]) | |
mymodel = mmpm[i].ids.machine_button.text | |
print("My model is: " + mymodel) | |
positions_to_fill = libs.apa_database.get_data( | |
#table_name='modelID_position', column_name='modelID', model=mymodel, #order_by_column='position_num') | |
#for i in range(0, len(positions_to_fill)): | |
#print(positions_to_fill[i][0] + str(positions_to_fill[i][1])) | |
#exec(mmpm + ".ids.position%d.text = '%s'" % i + 1, positions_to_fill[i][0] + positions_to_fill[i][1]) | |
self.add_widget(mmpm[i]) | |
def position_people(self): | |
# Get a list of all the available people | |
# c.execute('SELECT teammate FROM teammate_modelID_position WHERE modelID=current_model AND position_num=current_position') | |
# available_people = c.fetchall | |
# print(available_people) | |
# # Compare the training of each person with the list | |
# c.execute('SELECT * FROM teammate_modelID_position WHERE modelID=current_position) | |
# if current_person in c.fetchall: | |
# current_position_list += current_person | |
pass | |
def prioritize_position_by_training(self): | |
pass | |
# For each position, get the # of rows where people are trained in this position | |
class MmpModule(BoxLayout): | |
machine_name = StringProperty() | |
def __init__(self, **kwargs): | |
super(MmpModule, self).__init__(**kwargs) | |
self.machine_name = 'I-34' | |
self.model_name = 'CSEG' | |
class AutopositionerApp(App): | |
def build(self): | |
AutoPositionerRoot() | |
if __name__ == '__main__': | |
AutopositionerApp().run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment