Merge pull request #74 from bell07/pr_printer_support

Printer support
This commit is contained in:
Gerold55 2018-01-10 12:39:57 -05:00 committed by GitHub
commit 5e677e8243
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 449 additions and 20 deletions

3
API.md
View File

@ -58,6 +58,7 @@
data.selected_disk_name = fields.open_selected_disk -- Selected disk (prefix 'open_' is used)
data.selected_file_name = fields.open_selected_file -- Selected file (prefix 'open_' is used)
```
- `mtos:print_file_dialog({ label= , text= })` - call the print file dialog ('printer:app')
### Operating system attributes
`mtos.pos` - Computers position vector
@ -147,7 +148,7 @@ Can be used for non-data and/or system tasks. For usual data store please use th
- `bdev.os_format`- The format type: "none", "boot", "backup", "filesystem" (read-only)
- `bdev.rtype` - Removable type. "usb" or "floppy"
- `bdev.storage` - Data table used for app storage, if format is data compatible
- `bdev:reload()` - Reload all data from node inventory
- `bdev:reload(stack)` - Reload all data from node inventory. If stack is given, the stack will be inserted to slot
## Compatible Items
There is no own compatible items registrator. The item needs to match the item group to be usable with the laptops

View File

@ -3,7 +3,7 @@
laptop.register_app("mail", {
app_name = "Mail",
app_icon = "laptop_email_letter.png",
app_info = "Write mails to other players",
app_info = "Write Mail to Other Players",
formspec_func = function(app, mtos)
local cloud = mtos.bdev:get_app_storage('cloud', 'mail')
if not cloud then
@ -51,7 +51,7 @@ laptop.register_app("mail", {
-- set subject
if not message.subject or message.subject == "" then
formspec = formspec .. "(No subject),"
formspec = formspec .. "(No Subject),"
elseif string.len(message.subject) > 30 then
formspec = formspec .. minetest.formspec_escape(string.sub(message.subject,1,27)) .. "...,"
else
@ -79,19 +79,19 @@ laptop.register_app("mail", {
end
formspec = formspec .. ";"..(account.selected_index or "").."]"
else
formspec = formspec .. ",,No mail :(]"
formspec = formspec .. ",,No Mail :(]"
end
-- toggle inbox/sentbox
if account.selected_box == "inbox" then
formspec = formspec .. mtos.theme:get_image_button('0,9;1,1', 'minor', 'switch_sentbox', 'laptop_mail_sentbox.png', '', 'Show sent messages')
formspec = formspec .. mtos.theme:get_image_button('0,9;1,1', 'minor', 'switch_sentbox', 'laptop_mail_sentbox.png', '', 'Show Sent Messages')
else
formspec = formspec .. mtos.theme:get_image_button('0,9;1,1', 'minor', 'switch_inbox', 'laptop_mail_received.png', '', 'Show received messages')
formspec = formspec .. mtos.theme:get_image_button('0,9;1,1', 'minor', 'switch_inbox', 'laptop_mail_received.png', '', 'Show Received Messages')
end
formspec = formspec .. mtos.theme:get_image_button('1.7,9;1,1', 'minor', 'new', 'laptop_email_new.png', '', 'New message')
formspec = formspec .. mtos.theme:get_image_button('1.7,9;1,1', 'minor', 'new', 'laptop_email_new.png', '', 'New Message')
if account.newmessage then
formspec = formspec .. mtos.theme:get_image_button('2.7,9;1,1', 'minor', 'continue', 'laptop_email_edit.png', '', 'Continue last message')
formspec = formspec .. mtos.theme:get_image_button('2.7,9;1,1', 'minor', 'continue', 'laptop_email_edit.png', '', 'Continue Last Message')
end
if account.selectedmessage then
@ -101,11 +101,12 @@ laptop.register_app("mail", {
mtos.theme:get_image_button('5.7,9;1,1', 'minor', 'delete', 'laptop_email_trash.png', '', 'Delete')
if account.selected_box == "inbox" then
if not account.selectedmessage.is_read then
formspec = formspec .. mtos.theme:get_image_button('6.7,9;1,1', 'minor', 'markread', 'laptop_mail_read_button.png', '', 'Mark message as read')
formspec = formspec .. mtos.theme:get_image_button('6.7,9;1,1', 'minor', 'markread', 'laptop_mail_read_button.png', '', 'Mark Message as Read')
else
formspec = formspec .. mtos.theme:get_image_button('6.7,9;1,1', 'minor', 'markunread', 'laptop_mail_button.png', '', 'Mark message as unread')
formspec = formspec .. mtos.theme:get_image_button('6.7,9;1,1', 'minor', 'markunread', 'laptop_mail_button.png', '', 'Mark Message as Unread')
end
end
formspec = formspec .. mtos.theme:get_image_button('8,9;1,1', 'minor', 'print', 'printer_button.png', '', 'Print Email')
if account.selected_box == "inbox" then
formspec = formspec .. mtos.theme:get_label('8,0.5', "From: "..(account.selectedmessage.sender or ""))
else
@ -179,7 +180,14 @@ laptop.register_app("mail", {
account.selectedmessage.is_read = true
elseif fields.markunread then
account.selectedmessage.is_read = false
account.selected_timestamp = nil -- Stop timer
account.selected_timestamp = nil
elseif fields.print then
mtos:print_file_dialog({
label = account.selectedmessage.subject,
author = account.selectedmessage.sender,
timestamp = account.selectedmessage.time,
text = account.selectedmessage.body,
})
end
end
end
@ -188,7 +196,7 @@ laptop.register_app("mail", {
laptop.register_view("mail:newplayer", {
formspec_func = function(app, mtos)
return mtos.theme:get_label('1,3', "No mail account for player "..mtos.sysram.last_player.. " found. Do you like to create a new account?")..
mtos.theme:get_button('1,4;3,1', 'major', 'create', 'Create account')
mtos.theme:get_button('1,4;3,1', 'major', 'create', 'Create Account')
end,
receive_fields_func = function(app, mtos, sender, fields)
if sender:get_player_name() ~= mtos.sysram.last_player then

305
apps/os_print_app.lua Normal file
View File

@ -0,0 +1,305 @@
local printer_range = 10
local function trigger_queue(mtos)
-- Check print requirements
if mtos.sysdata.selected_view ~= 'output' or
mtos.sysdata.out_stack_save or
not mtos.sysdata.paper_count or mtos.sysdata.paper_count == 0 or
not mtos.sysdata.dye_count or mtos.sysdata.dye_count == 0 or
not mtos.sysdata.print_queue or
not mtos.sysdata.print_queue[1] then
mtos.sysdata.print_progress = 0
return false
end
-- timer done
if mtos.sysdata.print_progress >= 5 then
mtos.sysdata.print_progress = 0
mtos.sysdata.paper_count = mtos.sysdata.paper_count - 1
mtos.sysdata.dye_count = mtos.sysdata.dye_count - 0.1
local idata = mtos.bdev:get_removable_disk()
local stack = ItemStack("laptop:printed_paper")
local print_data = mtos.sysdata.print_queue[1]
stack:get_meta():from_table({ fields = print_data})
table.remove(mtos.sysdata.print_queue, 1)
idata:reload(stack)
idata.label = print_data.title
end
local timer = minetest.get_node_timer(mtos.pos)
if not timer:is_started() then
timer:start(1)
end
return true
end
local function sync_stack_values(mtos)
mtos.sysdata.paper_count = mtos.sysdata.paper_count or 0
mtos.sysdata.dye_count = mtos.sysdata.dye_count or 0
mtos.sysdata.print_progress = mtos.sysdata.print_progress or 0
local idata = mtos.bdev:get_removable_disk()
-- store old stack values
if mtos.sysdata.selected_view == 'paper' then
if idata.stack then
mtos.sysdata.paper_count = idata.stack:get_count()
else
mtos.sysdata.paper_count = 0
end
elseif mtos.sysdata.selected_view == 'dye' then
if idata.stack then
mtos.sysdata.dye_count = mtos.sysdata.dye_count - math.floor(mtos.sysdata.dye_count) + idata.stack:get_count()
else
mtos.sysdata.dye_count = mtos.sysdata.dye_count - math.floor(mtos.sysdata.dye_count)
end
elseif mtos.sysdata.selected_view == 'output' then
if idata.stack then
mtos.sysdata.out_stack_save = idata.stack:to_string()
else
mtos.sysdata.out_stack_save = nil
end
end
end
laptop.register_app("printer_launcher", {
-- app_name = "Printer firmware",
fullscreen = true,
formspec_func = function(launcher_app, mtos)
mtos.sysdata.print_queue = mtos.sysdata.print_queue or {}
mtos.sysdata.selected_view = mtos.sysdata.selected_view or 'output'
sync_stack_values(mtos)
trigger_queue(mtos)
-- inventory fields
local formspec = "size[9,8]"..
"list[current_player;main;0.3,3.85;8,1;]" ..
"list[current_player;main;0.3,5.08;8,3;8]" ..
"listring[nodemeta:"..mtos.pos.x..','..mtos.pos.y..','..mtos.pos.z..";main]" ..
"listring[current_player;main]"..
"label[0,0;"..mtos.hwdef.description.."]"
local idata = mtos.bdev:get_removable_disk()
-- queue
formspec = formspec ..
"tablecolumns[" ..
"text;".. -- label
"text;".. -- author
"text]".. -- timestamp
"table[0,0.5;5,2.42;printers;"
for idx, file in ipairs(mtos.sysdata.print_queue) do
if idx > 1 then
formspec = formspec..','
end
formspec = formspec .. minetest.formspec_escape(file.title or "")..','..
(file.author or "")..','..os.date("%c", file.timestamp)
end
formspec = formspec .. ";]"
local out_button = 'minor'
local paper_button = 'minor'
local dye_button = 'minor'
if mtos.sysdata.selected_view == 'paper' then
paper_button = 'major'
formspec = formspec .."background[6.2,0.8;2.5,0.7;"..mtos.theme.contrast_bg..']'
elseif mtos.sysdata.selected_view == 'dye' then
dye_button = 'major'
formspec = formspec .."background[6.2,1.5;2.5,0.7;"..mtos.theme.contrast_bg..']'
elseif mtos.sysdata.selected_view == 'output' then
out_button = 'major'
formspec = formspec .."background[6.2,2.2;2.5,0.7;"..mtos.theme.contrast_bg..']'
end
-- formspec = formspec .."background[5.2,"..(mtos.sysdata.print_progress/2+0.55)..";1.5,"..((4.9-mtos.sysdata.print_progress)/2)..";"..mtos.theme.contrast_bg..
formspec = formspec .."background[5.2,0.55;1.5,2.45;"..mtos.theme.contrast_bg..
']label[5.3,0.8;Paper: '..mtos.sysdata.paper_count..
']label[5.3,1.3;Dye: '..mtos.sysdata.dye_count..']'..
mtos.theme:get_button('6.8,0.8;1.5,0.7', paper_button, 'view_paper', 'Paper tray', 'Insert paper')..
mtos.theme:get_button('6.8,1.5;1.5,0.7', dye_button, 'view_dye', 'Dye tray', 'Insert black dye')..
mtos.theme:get_button('6.8,2.2;1.5,0.7', out_button, 'view_out', 'Output tray', 'Get printed paper')..
"list[nodemeta:"..mtos.pos.x..','..mtos.pos.y..','..mtos.pos.z..";main;5.4,1.8;1,1;]"..
mtos.theme:get_button('0.3,3;1.5,0.7', 'minor', 'reset', 'Reset', 'Reset printer queue')..
mtos.theme:get_button('2,3;1.5,0.7', 'minor', 'delete', 'Delete', 'Delete job')..
"background[3.7,3.1;"..(mtos.sysdata.print_progress)..",0.5;laptop_theme_red_back_button.png]"
return formspec
end,
appwindow_formspec_func = function(launcher_app, app, mtos)
local formspec = 'size[10,7]'
return formspec
end,
allow_metadata_inventory_put = function(app, mtos, player, listname, index, stack)
if mtos.sysdata.selected_view == 'output' then
-- nothing
elseif mtos.sysdata.selected_view == 'paper' and stack:get_name() == 'default:paper' then
return stack:get_stack_max()
elseif mtos.sysdata.selected_view == 'dye' and stack:get_name() == 'dye:black' then
return stack:get_stack_max()
end
return 0
end,
allow_metadata_inventory_take = function(app, mtos, player, listname, index, stack)
-- removal allways possible
return stack:get_count()
end,
receive_fields_func = function(app, mtos, sender, fields)
sync_stack_values(mtos)
local idata = mtos.bdev:get_removable_disk()
if fields.view_out then
mtos.sysdata.selected_view = 'output'
idata.stack = ItemStack(mtos.sysdata.out_stack_save or "")
elseif fields.view_paper then
mtos.sysdata.selected_view = 'paper'
idata.stack = ItemStack('default:paper')
idata.stack:set_count(mtos.sysdata.paper_count)
elseif fields.view_dye then
mtos.sysdata.selected_view = 'dye'
idata.stack = ItemStack('dye:black')
idata.stack:set_count(math.floor(mtos.sysdata.dye_count))
elseif fields.reset then
mtos.sysdata.print_queue = {}
mtos.sysdata.print_progress = 0
elseif fields.delete then
table.remove(mtos.sysdata.print_queue, 1)
mtos.sysdata.print_progress = 0
end
idata:reload(idata.stack)
trigger_queue(mtos)
end,
on_timer = function(app, mtos)
mtos.sysdata.print_progress = mtos.sysdata.print_progress + 1
return trigger_queue(mtos)
end,
})
local function get_printer_info(pos)
local hw_os = laptop.os_get(pos)
local printer
if hw_os then
printer = {
pos = pos,
name = hw_os.hwdef.description,
nodename = hw_os.node.name,
}
if not minetest.registered_items[hw_os.node.name].groups.laptop_printer then
printer.status = 'off'
printer.status_color = '#FF0000'
elseif not hw_os.sysram.current_app or hw_os.sysram.current_app == 'os:power_off' then
printer.status = 'disabled'
printer.status_color = '#FF0000'
else
printer.status = 'online'
printer.status_color = '#00FF00'
end
end
return printer
end
laptop.register_view("printer:app", {
app_info = "Print file",
formspec_func = function(app, mtos)
local store = mtos.bdev:get_app_storage('ram', 'printer:app')
local param = store.param
local sysstore = mtos.bdev:get_app_storage('system', 'printer:app')
sysstore.printers = sysstore.printers or {}
local formspec = mtos.theme:get_label('0.5,1', "Selected Printer:")
if sysstore.selected_printer then
local printer = get_printer_info(sysstore.selected_printer.pos)
if not printer then
printer = sysstore.selected_printer
printer.status = 'removed'
else
sysstore.selected_printer = printer
end
formspec = formspec .. 'item_image[0.5,1.5;1,1;'..printer.nodename..']'..
mtos.theme:get_label('1.5,1.7', minetest.formspec_escape(printer.name)..' '..
minetest.pos_to_string(printer.pos)..' '.. minetest.colorize(printer.status_color,printer.status))
end
formspec = formspec ..
"tablecolumns[" ..
"text;".. -- Printer name
"text;".. -- Printer position
"color;"..-- Status color
"text]".. -- Printer status
"table[0.5,2.5;6.5,4.2;printers;"
if sysstore.printers[1] then
local sel_idx = ""
for idx, printer in ipairs(sysstore.printers) do
if idx > 1 then
formspec = formspec..','
end
local pos_string = minetest.pos_to_string(printer.pos)
formspec = formspec..minetest.formspec_escape(printer.name)..','..
minetest.formspec_escape(minetest.pos_to_string(printer.pos))..','..
printer.status_color..','..printer.status
if sysstore.selected_printer and vector.distance(printer.pos, sysstore.selected_printer.pos) == 0 then
sel_idx = idx
end
end
formspec = formspec .. ";"..sel_idx.."]"
else
formspec = formspec .. "No printer found :(]"
end
formspec = formspec .. mtos.theme:get_button('2.7,9;2,0.7', 'minor', 'scan', 'Search', 'Scan for printers')
if sysstore.selected_printer and sysstore.selected_printer.status == 'online' then
formspec = formspec .. mtos.theme:get_button('10,9;2,0.7', 'major', 'print', 'Print', 'Print file')
end
param.label = param.label or "<unnamed>"
formspec = formspec .. "background[7.15,0.4;7.6,1;"..mtos.theme.contrast_bg.."]"..
"label[7.3,0.6;Heading:]".."field[9.7,0.7;5,1;label;;"..minetest.formspec_escape(param.label or "").."]"..
mtos.theme:get_label('9.7,1.7'," by "..(mtos.sysram.last_player or ""))..
"background[7.15,2.55;7.6,6.0;"..mtos.theme.contrast_bg.."]"..
"textarea[7.5,2.5;7.5,7;;"..(minetest.formspec_escape(param.text) or "")..";]"
return formspec
end,
receive_fields_func = function(app, mtos, sender, fields)
local store = mtos.bdev:get_app_storage('ram', 'printer:app')
local param = store.param
local sysstore = mtos.bdev:get_app_storage('system', 'printer:app')
sysstore.printers = sysstore.printers or {}
if fields.scan then
sysstore.printers = {}
local nodes = minetest.find_nodes_in_area({x = mtos.pos.x-printer_range, y= mtos.pos.y-printer_range, z = mtos.pos.z-printer_range},
{x = mtos.pos.x+printer_range, y= mtos.pos.y+printer_range, z = mtos.pos.z+printer_range}, {"group:laptop_printer"})
for _, pos in ipairs(nodes) do
local printer = get_printer_info(pos)
if printer then
printer.printer_os = nil -- do not store whole OS
table.insert(sysstore.printers, printer)
end
end
table.sort(sysstore.printers, function(a,b) return vector.distance(a.pos, mtos.pos) < vector.distance(b.pos, mtos.pos) end)
end
if fields.printers then
local event = minetest.explode_table_event(fields.printers)
sysstore.selected_printer = sysstore.printers[event.row] or sysstore.selected_printer
end
if fields.label then
param.label = fields.label
end
if fields.print then
local hw_os = laptop.os_get(sysstore.selected_printer.pos)
if hw_os and minetest.registered_items[hw_os.node.name].groups.laptop_printer then
hw_os.sysdata.print_queue = hw_os.sysdata.print_queue or {}
sync_stack_values(hw_os)
table.insert(hw_os.sysdata.print_queue, { title = param.label, text = param.text, author = param.author or sender:get_player_name(), timestamp = param.timestamp or os.time() })
hw_os:set_app() --update page
app:back_app()
end
end
end,
})

View File

@ -1,6 +1,6 @@
laptop.register_app("removable", {
app_name = "Removable storage",
app_name = "Removable Storage",
app_icon = "laptop_hard_drive.png",
app_info = "Work with removable media",
formspec_func = function(app, mtos)

View File

@ -26,7 +26,8 @@ laptop.register_app("stickynote", {
"textarea[0.35,1.35;15.08,9.5;text;;"..minetest.formspec_escape(data.text).."]"..
mtos.theme:get_button('0,0.5;1.5,0.8', 'minor', 'clear', 'New', 'New file')..
mtos.theme:get_button('2,0.5;1.5,0.8', 'minor', 'load', 'Load', 'Load file')..
mtos.theme:get_button('4,0.5;1.5,0.8', 'minor', 'save', 'Save', 'Save file')
mtos.theme:get_button('4,0.5;1.5,0.8', 'minor', 'save', 'Save', 'Save file')..
mtos.theme:get_button('8,0.5;1.5,0.8', 'minor', 'print', 'Print', 'Print file')
return formspec
end,
receive_fields_func = function(app, mtos, sender, fields)
@ -71,6 +72,11 @@ laptop.register_app("stickynote", {
data.selected_disk_name = nil
data.selected_file_name = nil
data.text = ""
elseif fields.print then
mtos:print_file_dialog({
label = data.selected_file_name,
text = data.text,
})
end
end
})

View File

@ -44,10 +44,10 @@ function bdev:get_removable_disk(removable_type)
local data = { bdev = self }
data.inv = self.os.meta:get_inventory()
data.inv:set_size("main", 1) -- 1 disk supported
function data:reload()
function data:reload(stack)
-- self.inv unchanged
-- self.rtype unchanged (assumption
local stack = data.inv:get_stack("main", 1)
stack = stack or data.inv:get_stack("main", 1)
if stack then
local def = stack:get_definition()
if def and def.name ~= "" then
@ -152,10 +152,12 @@ function bdev:sync()
-- save removable
if self.removable_disk then
if self.removable_disk.stack then
if self.removable_disk.label ~= self.removable_disk.def.description then
if self.removable_disk.def and self.removable_disk.label ~= self.removable_disk.def.description then
self.removable_disk.meta:set_string("description", self.removable_disk.label)
end
self.removable_disk.meta:set_string("os_storage", minetest.serialize(self.removable_disk.storage))
if self.removable_disk.storage then
self.removable_disk.meta:set_string("os_storage", minetest.serialize(self.removable_disk.storage))
end
end
self.removable_disk.inv:set_stack("main", 1, self.removable_disk.stack)
end

View File

@ -12,3 +12,22 @@ minetest.register_craftitem("laptop:usbstick", {
groups = {laptop_removable_usb = 1},
stack_max = 1,
})
minetest.register_craftitem("laptop:printed_paper", {
description = 'Printed paper',
inventory_image = "laptop_printed_paper.png",
groups = {not_in_creative_inventory = 1},
stack_max = 1,
on_use = function(itemstack, user)
local meta = itemstack:get_meta()
local data = meta:to_table().fields
local formspec = "size[8,8]" .. default.gui_bg .. default.gui_bg_img ..
"label[0,0;" .. minetest.formspec_escape(data.title or "unnamed") ..
" by " .. (data.author or "unknown") .. " from " .. os.date("%c", data.timestamp) .. "]"..
"textarea[0.5,1;7.5,7;;" ..
minetest.formspec_escape(data.text or "test text") .. ";]"
minetest.show_formspec(user:get_player_name(), "laptop:printed_paper", formspec)
return itemstack
end
})

View File

@ -33,9 +33,9 @@ local function on_punch(pos, node, puncher)
local slot = mtos.bdev:get_removable_disk()
-- swap
puncher:set_wielded_item(slot.stack)
slot.inv:set_stack("main", 1, punch_item)
-- reload OS
slot:reload()
slot:reload(punch_item)
mtos.bdev:sync()
for k,v in pairs(laptop.os_get(mtos.pos)) do
mtos[k] = v
end

View File

@ -70,6 +70,85 @@ laptop.register_hardware("laptop:core", {
}
})
laptop.register_hardware("laptop:printer", {
description = "Flash Printex",
infotext = 'Flash Printex',
sequence = { "off", "powersave", "on" },
custom_launcher = "printer_launcher",
hw_capabilities = {"hdd"},
node_defs = {
["powersave"] = {
hw_state = "power_off",
tiles = {
"laptop_printer_top.png",
"laptop_printer_bottom.png",
"laptop_printer_right.png",
"laptop_printer_left.png",
"laptop_printer_back.png",
"laptop_printer_front.png",
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {choppy=2, oddly_breakably_by_hand=2, dig_immediate = 2, laptop_printer = 1},
node_box = {
type = "fixed",
fixed = {
{-0.375, -0.5, -0.125, 0.375, -0.125, 0.3125}, -- core
{-0.25, -0.5, -0.375, 0.25, -0.4375, -0.125}, -- tray
{-0.25, -0.125, 0.25, 0.25, 0.125, 0.3125}, -- charger
}
}
},
["on"] = {
hw_state = "power_on",
tiles = {
"laptop_printer_top.png",
"laptop_printer_bottom.png",
"laptop_printer_right.png",
"laptop_printer_left.png",
"laptop_printer_back.png",
"laptop_printer_front_on.png",
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {choppy=2, oddly_breakably_by_hand=2, dig_immediate = 2, laptop_printer = 1},
node_box = {
type = "fixed",
fixed = {
{-0.375, -0.5, -0.125, 0.375, -0.125, 0.3125}, -- core
{-0.25, -0.5, -0.375, 0.25, -0.4375, -0.125}, -- tray
{-0.25, -0.125, 0.25, 0.25, 0.125, 0.3125}, -- charger
}
}
},
["off"] = {
hw_state = "power_off",
tiles = {
"laptop_printer_top.png",
"laptop_printer_bottom.png",
"laptop_printer_right.png",
"laptop_printer_left.png",
"laptop_printer_back.png",
"laptop_printer_front_off.png",
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
node_box = {
type = "fixed",
fixed = {
{-0.375, -0.5, -0.125, 0.375, -0.125, 0.3125}, -- core
{-0.25, -0.5, -0.375, 0.25, -0.4375, -0.125}, -- tray
{-0.25, -0.125, 0.25, 0.25, 0.125, 0.3125}, -- charger
}
}
}
}
})
laptop.register_hardware("laptop:cube", {
description = "CUBE PC",
infotext = "CUBE PC",

9
os.lua
View File

@ -171,6 +171,15 @@ function os_class:select_file_dialog(param)
store.param = param
self:set_app('os:select_file')
end
-- Use parameter and launch the select_file dialog
-- Return values will be send as fields to the called app
function os_class:print_file_dialog(param)
local store = self.bdev:get_app_storage('ram', 'printer:app')
store.param = param
self:set_app('printer:app')
end
-----------------------------------------------------
-- Get Operating system object
-----------------------------------------------------

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 444 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 451 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 532 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 517 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 496 B

BIN
textures/printer_button.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B