basic stuff
This commit is contained in:
commit
c86abfe088
|
@ -0,0 +1 @@
|
|||
/target
|
|
@ -0,0 +1,7 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "rad"
|
||||
version = "0.1.0"
|
|
@ -0,0 +1,8 @@
|
|||
[package]
|
||||
name = "rad"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
|
@ -0,0 +1,15 @@
|
|||
result="$( yad \
|
||||
--title "$( eval_gettext "New user" )" --center --form \
|
||||
--field="$( eval_gettext "Configure a new user" ):LBL" "" \
|
||||
--field=":LBL" "" \
|
||||
--field="$( eval_gettext "Username (no spaces, short)" )" "$username" \
|
||||
--field="$( eval_gettext "User's real name" )" "$username_real" \
|
||||
--field="$( eval_gettext "Email (for Gravatar)" )" "$user_email" \
|
||||
--field="$( eval_gettext "Password" ):H" "$password" \
|
||||
--field="$( eval_gettext "Password confirmation" ):H" "$password" \
|
||||
--field="$( eval_gettext "Auto-login to desktop" ):CHK" "$want_autologin" \
|
||||
--field="$( eval_gettext "Privileges to install packages" ):CHK" "$want_sudo_apt" \
|
||||
--field="$( eval_gettext "Grant admin (sudo) privileges (recommended)" ):CHK" "$want_sudo" \
|
||||
--field="$( eval_gettext "Grant admin, and never request the password (not recommended)" ):CHK" "FALSE" \
|
||||
|| echo cancel )"
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
enum CallbackType {
|
||||
OnModify,
|
||||
OnClick,
|
||||
OnMouseEnter,
|
||||
OnMouseLeave,
|
||||
}
|
||||
|
||||
enum WhatDo {
|
||||
AddWidget(Widget),
|
||||
RemoveWidget(usize),
|
||||
Cancel,
|
||||
Submit,
|
||||
}
|
||||
|
||||
struct Callback {
|
||||
raw: String,
|
||||
callback_type: CallbackType,
|
||||
whatdo: String
|
||||
}
|
||||
|
||||
enum NewLinePositioning {
|
||||
Before,
|
||||
After,
|
||||
Both
|
||||
}
|
||||
|
||||
struct Positioning {
|
||||
NewLine(NewLinePositioning)
|
||||
NoNewLine,
|
||||
Absolute(f32, f32)
|
||||
}
|
||||
|
||||
enum InputType {
|
||||
Password,
|
||||
Date,
|
||||
Normie,
|
||||
Number,
|
||||
Character
|
||||
}
|
||||
|
||||
enum Widget {
|
||||
Label(String),
|
||||
Button(String, Callback),
|
||||
InputBox(String, Callback, InputType),
|
||||
Checkbox(bool, Callback), // the bool is the default value
|
||||
CancelButton,
|
||||
SubmitButton,
|
||||
}
|
||||
|
||||
struct Window {
|
||||
title: String,
|
||||
widgets: Vec<Widget>
|
||||
}
|
||||
|
||||
impl Window {
|
||||
fn add_widget(&mut self, widget: Widget) -> usize {
|
||||
self.widgets.push(widget);
|
||||
self.widgets.len()
|
||||
}
|
||||
fn remove_widget(&mut self, id: usize) -> usize {
|
||||
self.widgets.remove(id);
|
||||
self.widgets.len()
|
||||
}
|
||||
fn update_title(&mut self, title: String) {
|
||||
self.title = title;
|
||||
}
|
||||
/// Will output in a yad-compatible format.
|
||||
fn submit(&mut self) -> String {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
println!("Welcome to rad!");
|
||||
}
|
Loading…
Reference in New Issue