mirror of
https://github.com/nekename/OpenDeck.git
synced 2026-10-28 18:02:23 +00:00
Trim trailing whitespace
This commit is contained in:
1 parent
01e88925a4
commit
f15ed576a1
9 files changed
+19
-19
No files matched your search
@@ -15,7 +15,7 @@ pub trait BaseDevice {
|
||||
fn num_keys(&self) -> u8 {
|
||||
self.num_rows() * self.num_columns()
|
||||
}
|
||||
|
||||
|
||||
fn id(&self) -> String;
|
||||
fn name(&self) -> String;
|
||||
fn r#type(&self) -> u8;
|
||||
|
||||
@@ -49,7 +49,7 @@ impl ProntoKeyDevice {
|
||||
Ok(p) => p,
|
||||
Err(error) => panic!("Failed to open serial port: {}", error)
|
||||
};
|
||||
let _ = port.write("register".as_bytes());
|
||||
let _ = port.write("register".as_bytes());
|
||||
|
||||
let mut serial_buf: Vec<u8> = vec![0; 1024];
|
||||
let mut holding_string = String::from("");
|
||||
@@ -70,7 +70,7 @@ impl ProntoKeyDevice {
|
||||
Err(_) => continue
|
||||
};
|
||||
holding_string = holding_string[(index + 1)..].to_owned();
|
||||
|
||||
|
||||
// If the device is uninitialised, attempt to read its MAC address and initialise.
|
||||
if device.is_none() {
|
||||
if let Value::String(address) = &j["address"] {
|
||||
|
||||
@@ -26,9 +26,9 @@ async fn main() {
|
||||
Ok(app) => app,
|
||||
Err(error) => panic!("Failed to create Tauri application: {}", error)
|
||||
};
|
||||
|
||||
|
||||
devices::initialise_devices();
|
||||
plugins::initialise_plugins(app.handle());
|
||||
|
||||
|
||||
app.run(|_, _| {});
|
||||
}
|
||||
@@ -19,14 +19,14 @@ fn initialise_plugin(path: path::PathBuf, app: &AppHandle, categories: &mut Hash
|
||||
let plugin_uuid = path.file_name().unwrap().to_str().unwrap();
|
||||
let mut manifest_path = path.clone();
|
||||
manifest_path.push("manifest.json");
|
||||
|
||||
|
||||
let manifest =
|
||||
fs::read(&manifest_path)
|
||||
.with_context(|| { format!("Failed to read manifest of plugin at {}", manifest_path.display()) })?;
|
||||
let mut manifest: manifest::PluginManifest =
|
||||
serde_json::from_slice(&manifest)
|
||||
.with_context(|| { format!("Failed to parse manifest of plugin at {}", manifest_path.display()) })?;
|
||||
|
||||
|
||||
for action in &mut manifest.actions {
|
||||
action.plugin = plugin_uuid.to_owned();
|
||||
|
||||
@@ -78,7 +78,7 @@ fn initialise_plugin(path: path::PathBuf, app: &AppHandle, categories: &mut Hash
|
||||
if manifest.code_path_macos.is_some() { code_path = manifest.code_path_macos; }
|
||||
#[cfg(target_os = "linux")]
|
||||
if manifest.code_path_linux.is_some() { code_path = manifest.code_path_linux; }
|
||||
|
||||
|
||||
if let Some(code_path) = &code_path {
|
||||
use_browser = code_path.ends_with(".html");
|
||||
}
|
||||
@@ -115,7 +115,7 @@ fn initialise_plugin(path: path::PathBuf, app: &AppHandle, categories: &mut Hash
|
||||
},
|
||||
devicePixelRatio: 0,
|
||||
colors: info_param::ColoursInfo {
|
||||
buttonPressedBackgroundColor: String::from("#303030FF"),
|
||||
buttonPressedBackgroundColor: String::from("#303030FF"),
|
||||
buttonPressedBorderColor: String::from("#646464FF"),
|
||||
buttonPressedTextColor: String::from("#969696FF"),
|
||||
disabledColor: String::from("#F7821B59"),
|
||||
|
||||
@@ -88,7 +88,7 @@ pub struct Action {
|
||||
#[serde_inline_default(vec![String::from("Keypad")])]
|
||||
#[serde(alias = "Controllers")]
|
||||
pub controllers: Vec<String>,
|
||||
|
||||
|
||||
#[serde(alias = "States")]
|
||||
pub states: Vec<ActionState>
|
||||
}
|
||||
@@ -100,7 +100,7 @@ pub struct ActionContext {
|
||||
pub profile: String,
|
||||
pub controller: String,
|
||||
pub position: u8,
|
||||
pub index: u16
|
||||
pub index: u16
|
||||
}
|
||||
|
||||
impl ToString for ActionContext {
|
||||
|
||||
@@ -25,7 +25,7 @@ impl<T> Store<T> where T: Serialize + for<'a> Deserialize<'a> {
|
||||
.with_context(|| { format!("Failed to read contents of file at {}", &path.display()) })?;
|
||||
let existing_value: T = serde_json::from_slice(&file_contents)
|
||||
.with_context(|| { format!("Failed to parse config file at {}", &path.display()) })?;
|
||||
|
||||
|
||||
Ok(Self {
|
||||
path,
|
||||
id: String::from(id),
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
import { invoke } from "@tauri-apps/api";
|
||||
|
||||
let devices: { [id: string]: DeviceInfo } = {};
|
||||
|
||||
|
||||
async function refreshDevices() {
|
||||
devices = JSON.parse(await invoke("get_devices"));
|
||||
}
|
||||
setTimeout(refreshDevices, 5e2);
|
||||
|
||||
|
||||
let value: string;
|
||||
export let device = null;
|
||||
export let device: DeviceInfo | null;
|
||||
function change() {
|
||||
if (value == "refresh_devices") {
|
||||
refreshDevices();
|
||||
@@ -26,6 +26,6 @@
|
||||
{#each Object.entries(devices) as [ id, device ]}
|
||||
<option value={id}> {device.name} </option>
|
||||
{/each}
|
||||
|
||||
|
||||
<option value="refresh_devices"> Refresh devices </option>
|
||||
</select>
|
||||
@@ -19,7 +19,7 @@
|
||||
instance={profile.sliders[i]}
|
||||
/>
|
||||
{/each}
|
||||
|
||||
|
||||
<div class="flex flex-col">
|
||||
{#each { length: device.rows } as _, r}
|
||||
<div class="flex flex-row">
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
profiles = JSON.parse(await invoke("get_profiles", { device: device.id }));
|
||||
value = profiles[0];
|
||||
}
|
||||
|
||||
|
||||
export let profile: Profile;
|
||||
async function setProfile(id: string) {
|
||||
if (!device || !id) return;
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
let value: string;
|
||||
$: setProfile(value);
|
||||
|
||||
|
||||
export let device: DeviceInfo;
|
||||
$: getProfiles(device);
|
||||
</script>
|
||||
|
||||
Reference in new issue
Block a user