Skip to content

Commit

Permalink
Fix AOrm command
Browse files Browse the repository at this point in the history
  • Loading branch information
ales-tsurko committed Nov 2, 2024
1 parent 95f4673 commit bdcae87
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
16 changes: 11 additions & 5 deletions pysrc/athenaCL/libATH/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -7433,10 +7433,10 @@ class AOrm(_CommandAO):

def __init__(self, ao, args="", **keywords):
_CommandAO.__init__(self, ao, args, **keywords)
self.processSwitch = 0 # display only
self.processSwitch = 1 # display only
self.gatherSwitch = 1 # display only
self.cmdStr = "AOrm"
self.subCmd = 1 # if 1, executed within method of interptreter
# self.subCmd = 1 # if 1, executed within method of interptreter

def gather(self):
args = self.args
Expand All @@ -7453,14 +7453,20 @@ def gather(self):
self.confirm = "confirm"

def process(self):
pass
if self.confirm != "confirm":
return
self.ao.pathLib.clear()
self.ao.textureLib.clear()
self.ao.setActiveTexture("")
self.ao.setActivePath("")
self._piUpdateAllReferences()

def log(self): # no history stored, as ao is removed
if self.gatherStatus and self.processStatus: # if complete
return "%s %s" % (self.cmdStr, self.confirm)

def result(self):
return {}
def display(self):
return "AthenaObject has removed"


class APgfx(Command):
Expand Down
8 changes: 5 additions & 3 deletions src/app/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ pub fn update(state: &mut State, message: Message) -> Task<Message> {
}

if let Some(Output::MidiPlayer(player)) = state.output.get_mut(id) {
player.is_playing = true;
if player.path.exists() {
player.is_playing = true;
if let Err(e) = state
.midi_player_state
.controller
Expand All @@ -120,6 +120,8 @@ pub fn update(state: &mut State, message: Message) -> Task<Message> {
state.midi_player_state.update_tempo();
state.midi_player_state.controller.play();
state.midi_player_state.playing_id = Some(id);
} else {
player.is_playing = false;
}
}
}
Expand Down Expand Up @@ -397,9 +399,9 @@ fn view_pici_chooser(state: &State) -> Element<Message> {
};

row![
text("Path:"),
text("PI:"),
pick_list(state.path_lib.as_slice(), pi_selection, Message::PiSelected).placeholder("{pi}"),
text("Texture:"),
text("TI:"),
pick_list(
state.texture_lib.as_slice(),
ti_selection,
Expand Down
9 changes: 4 additions & 5 deletions src/interpreter/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use std::sync::LazyLock;
use std::thread;

use super::{dialog_ext, xml_tools_ext, athena_obj_ext};
use super::{athena_obj_ext, dialog_ext, xml_tools_ext};
use async_channel::{unbounded, Receiver, Sender};
use rustpython_vm as vm;
use thiserror::Error;
Expand Down Expand Up @@ -97,7 +97,7 @@ pub enum Message {
TextureLibUpdated(Vec<String>),
// Not system file path, but athenaCL pitch path
ActivePathSet(String),
ActiveTextureSet(String)
ActiveTextureSet(String),
}

impl From<Error> for Message {
Expand Down Expand Up @@ -217,9 +217,8 @@ fn extract_result_tuple(vm: &VirtualMachine, result: PyObjectRef) -> PyResult<(b
// Extract and convert the second element to String
let str_part = elements[1]
.payload::<PyStr>()
.ok_or_else(|| vm.new_type_error("Expected a string".to_owned()))?
.as_str()
.to_owned();
.map(|v| v.as_str().to_owned())
.unwrap_or_default();

Ok((bool_part, str_part))
} else {
Expand Down

0 comments on commit bdcae87

Please sign in to comment.