Skip to content

Commit

Permalink
wip erledigt, Kosmetik
Browse files Browse the repository at this point in the history
  • Loading branch information
hmt committed Aug 15, 2020
1 parent e683408 commit c8dda97
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ jobs:
node-version: 13
- name: Install Dependencies
run: npm install
- name: set version
run: |
echo "export const VERSION = { gitHash: '${{ github.sha }}', buildVersion: '1.0.${{ github.run_number }}', production: true }" > src/version.js
- name: show version
run: cat src/version.js
- name: Build
env:
THE_AUTHOR: ${{ secrets.AUTHOR }}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Einstellungen.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
<input type="checkbox" bind:checked={$configData.gruppe_auto_pdf}>
Automatisch als PDF ablegen
</label>
<p class="help">Diese Einstellung erstellt ein PDF in der Form <code>Jahrgang_Kurs_Datum_Zeit.pdf</code> im lokalen Dokumentenordner</p>
<p class="help">Diese Einstellung erstellt ein PDF in der Form <code>Jahrgang_Kurs_Datum_Zeit.pdf</code> im PDF-Verzeichnis</p>
</div>
<div class="field">
<p class="control">
Expand Down
25 changes: 17 additions & 8 deletions src/components/Print.svelte
Original file line number Diff line number Diff line change
@@ -1,28 +1,35 @@
<script>
import { schueler, medien, titel, print, configData } from "./../stores.js";
import { schueler, print, configData } from "./../stores.js";
import { ipcRenderer } from 'electron'
import PrintKurs from './Print/Kurs.svelte'
import PrintSchueler from './Print/Schueler.svelte'
import PrintMedien from './Print/Medien.svelte'
import * as notifier from './../notifier.js'
let c
const pdf_name = _ => {
const d = new Date().getTime()
return `${$schueler[0].klasse}_${$schueler[0].kurs}_${$schueler[0].jahr}_${d}.pdf`
}
ipcRenderer.on('pdf-reply', (event, arg) => {
console.log('PDF: ', arg)
notifier.fertig('PDF erfolgreich gespeichert')
})
ipcRenderer.on('print-reply', (event, arg) => {
console.log('Print: ', arg)
})
function handle_keydown(event) {
if (event.key === "Escape") $print = false;
if (event.key === 'p') ipcRenderer.send('print', 'print')
if (event.key === 's') ipcRenderer.send('pdf', "test_case.pdf")
if (event.key === 'p') ipcRenderer.send('print')
if (event.key === 's') ipcRenderer.send('pdf', pdf_name())
}
async function loader (file) {
const component = import(`./Print/${file}.svelte`)
return component
function run_settings (node) {
if (c != PrintKurs) return
$configData.gruppe_print_dialog && ipcRenderer.send('print')
$configData.gruppe_auto_pdf && ipcRenderer.send('pdf', pdf_name())
}
$: if ($print.name === 'Schueler') c = PrintSchueler
Expand All @@ -33,7 +40,7 @@
<svelte:window on:keydown={handle_keydown} />

{#if c}
<article class="message is-default no-print" style="position: absolute; top: 2rem; left: 65rem">
<article class="message is-default no-print" style="position: absolute; top: 2rem; left: 65rem" use:run_settings>
<div class="message-header">
<span class="icon">
<i class="mdi">info</i>
Expand All @@ -43,8 +50,10 @@
<div class="message-body">
Drucken: <b>p</b>
<br>
PDF: <b>s</b>
<br>
Abbrechen: <b>ESC</b>
</div>
</article>
<svelte:component this={c} />
<svelte:component this={c}/>
{/if}
6 changes: 5 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import { is } from 'electron-util'
import { join, dirname } from "path";
import { writeFile, existsSync, mkdirSync } from "fs";
import configData from './configstore'
import { VERSION } from './version'

console.log(VERSION)
if (process.argv.some(a => a === '-v')) app.exit()

let mainWindow

Expand All @@ -20,7 +24,7 @@ function createWindow() {
webPreferences: {
nodeIntegration: true
},
title: `${app.name}`
title: `${app.name} ${VERSION['buildVersion']}`
// icon: join(__dirname, '../icons/icon.png')
})
mainWindow.removeMenu()
Expand Down
1 change: 1 addition & 0 deletions src/version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const VERSION = { buildVersion: 'development', gitHash: 'development', production: false }

0 comments on commit c8dda97

Please sign in to comment.