adding git intergration (finally!)

This commit is contained in:
langolierz
2018-10-15 21:07:30 +00:00
parent 2231e6e933
commit 37ce6331ba
7 changed files with 46 additions and 14 deletions

View File

@@ -7,6 +7,7 @@ from pythonosc import osc_message_builder
from pythonosc import dispatcher
from pythonosc import osc_server
from pythonosc import dispatcher
from git import Repo
import threading
import argparse
from video_centre.capture import Capture
@@ -512,5 +513,34 @@ class Actions(object):
if self.serial_port_process is not None:
self.serial_port_process.kill()
self.serial_port_process = None
def try_pull_code_and_reset(self):
recur_repo = Repo("~/r_e_c_u_r")
conjur_repo = Repo("~/openFrameworks/apps/myApps/c_o_n_j_u_r")
current_recur_hash = recur_repo.head.object.hexsha
current_conjur_hash = conjur_repo.head.object.hexsha
recur_repo.remotes.origin.pull()
conjur_repo.remotes.origin.pull()
new_recur_hash = recur_repo.head.object.hexsha
new_conjur_hash = conjur_repo.head.object.hexsha
if current_recur_hash != new_recur_hash or current_conjur_hash != new_conjur_hash :
#something has changed!
os.remove('/home/pi/r_e_c_u_r/json_objects/settings.json')
if current_conjur_hash != new_conjur_hash :
self.message_handler.set_message('INFO', 'compiling OF pls wait')
self.tk.after(100,self.complie_openframeworks)
else:
self.restart_the_program()
else:
self.message_handler.set_message('INFO', 'up to date !')
def complie_openframeworks(self):
subprocess.call(['make', '--directory=~/openFrameworks/apps/myApps/c_o_n_j_u_r' ])
self.message_handler.set_message('INFO', 'finished compiling!')
self.restart_the_program()

View File

@@ -88,13 +88,13 @@ class Display(object):
bank_data = self.data.bank_data[self.data.bank_number]
self.display_text.insert(END, '------------------ <SAMPLER> ------------------ \n')
self.display_text.tag_add("DISPLAY_MODE", 4.19, 4.29)
self.display_text.insert(END, '{:>6} {:<17} {:>5} {:<5} {:<5} {:<4}\n'.format(
'{}-slot'.format(self.data.bank_number), 'name', 'length', 'start', 'end', 'spd'))
self.display_text.insert(END, '{:>6} {:<17} {:>5} {:<5} {:<5} \n'.format(
'{}-slot'.format(self.data.bank_number), 'name', 'length', 'start', 'end'))
for index, slot in enumerate(bank_data):
name_without_extension = slot['name'].rsplit('.',1)[0]
self.display_text.insert(END, '{:^6} {:<17} {:^5} {:>5} {:<5} {:>4}\n'.format(
self.display_text.insert(END, '{:^6} {:<17} {:^5} {:>5} {:<5} \n'.format(
index, name_without_extension[0:17], self.format_time_value(slot['length']),
self.format_time_value(slot['start']), self.format_time_value(slot['end']),self.format_speed_value(slot['rate'])))
self.format_time_value(slot['start']), self.format_time_value(slot['end'])))
if self.data.is_this_path_broken(slot['location']):
self.display_text.tag_add("BROKEN_PATH", self.ROW_OFFSET + index,
self.ROW_OFFSET + self.SELECTOR_WIDTH + index)

View File

@@ -1,6 +1,6 @@
# documenting all the steps from old img of recur to working with new features
- gonna start with a `sudo raspi-update` and `sudo apt-get update -y; sudo apt-get upgrade - y`
- gonna start with a `sudo raspi-update` and `sudo apt-get update -y; sudo apt-get upgrade -y`
## setup
@@ -25,6 +25,7 @@ i had of10 zipped on a flashdrive already (wget errored about insecure connectio
- `sudo pip3 install Adafruit_GPIO Adafruit_MCP3008 RPi.GPIO pivideo python-osc` (tried to install threading but didnt work...)
- (note atleast pivideo needs to be installed with sudo.), also needs `sudo pip3 install serial``
- pip3 install gitpython
- `sudo apt-get install glslviewer`
### installing ttymidi :

View File

@@ -121,6 +121,11 @@
],
"value": "disabled"
},
"UPDATE_CODE": {
"action": "try_pull_code_and_reset",
"options": [],
"value": null
},
"DEV_MODE_RESET": {
"action": "switch_dev_mode",
"options": [

View File

@@ -24,10 +24,11 @@ class OfCapture(object):
print('its picapture with no source !')
return False
self.update_capture_settings()
#if not self.check_if_attached_with_picamera():
# return
if not self.check_if_attached_with_picamera():
return
print('sending setup message !')
self.osc_client.send_message("/capture/setup", True)
self.osc_client.send_message("/capture/setup", self.capture_type)
# try:
# self.device = picamera.PiCamera(resolution=self.resolution, framerate=self.framerate, sensor_mode = self.sensor_mode)
# except picamera.exc.PiCameraError as e:

View File

@@ -14,7 +14,6 @@ class Shaders(object):
self.selected_shader = self.EMPTY_SHADER
self.focused_param = None
self.shaders_menu_list = self.generate_shaders_list()
print(self.shaders_menu_list)
if self.shaders_menu_list is not None:
pass
@@ -30,7 +29,6 @@ class Shaders(object):
if line['is_shader']:
stripped_name = line['name'].lstrip()
has_path, path = self.get_path_for_shader(stripped_name)
print('shader {} , has path {} it is {}'.format(stripped_name, has_path, path))
shad_type = self.determine_if_shader_file_is_processing(path)
parameter_number = self.determine_shader_parameter_number(path)
#print('shader index is {}'.format(shad_i))
@@ -50,7 +48,6 @@ class Shaders(object):
return False, ''
def determine_if_shader_file_is_processing(self, path):
print('the path is {}'.format(path))
with open(path, 'r') as selected_shader:
shader_text = selected_shader.read()
if '//pro-shader' in shader_text:
@@ -71,7 +68,6 @@ class Shaders(object):
return max_amount
def load_selected_shader(self):
print(self.selected_shader)
self.selected_param_values = [0.0,0.0,0.0,0.0]
is_pro = self.selected_shader['shad_type'] == 'pro'
self.osc_client.send_message("/shader/load", [self.selected_shader['path'],is_pro,self.selected_shader['param_number']])
@@ -91,7 +87,6 @@ class Shaders(object):
is_file, name = self.shaders_menu.extract_file_type_and_name_from_menu_format(
self.shaders_menu_list[index]['name'])
is_selected_shader = False
print('for the current selection the shader path is {} , and its name is {} , the check says is it a shader {} , '.format(self.shaders_menu_list[index]['path'], self.shaders_menu_list[index]['name'] ,self.shaders_menu_list[index]['is_shader']))
if is_file and name == self.selected_shader['name'].lstrip():
is_selected_shader = True
elif is_file:

View File

@@ -24,7 +24,7 @@ class VideoDriver(object):
self.root.after(self.delay, self.begin_playing)
self.print_status()
self.update_video_settings()
#self.update_video_settings()
def update_video_settings(self):