blob: 85bf557802d4a8789095ecfe96365515a7d458f9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
<template>
<v-dialog max-width="500px" value="true">
<v-card v-if="step == 'pick'" key="pick" rounded="lg" :loading="installing" :disabled="installing">
<v-card-title>
<translate>
Install Palettes
</translate>
</v-card-title>
<v-card-text class="text--primary">
<translate>Ink/Stitch can install palettes for Inkscape matching the thread colors from popular machine embroidery thread manufacturers.
</translate>
</v-card-text>
<v-file-input class="mb-3 mx-3" webkitdirectory hide-details v-model="path"
:label="$gettext('Choose Inkscape directory')"></v-file-input>
<v-card-actions>
<v-btn text color="primary" v-on:click="install">
<v-icon>mdi-palette</v-icon>
<translate>Install</translate>
</v-btn>
<v-btn text color="primary" v-on:click="close">
<translate>Cancel</translate>
</v-btn>
</v-card-actions>
</v-card>
<v-card v-if="step == 'done'" key="done">
<v-card-title>
<translate>
Installation Completed
</translate>
</v-card-title>
<v-card-text class="text--primary">
<translate>
Inkscape palettes have been installed. Please restart Inkscape to load the new palettes.
</translate>
</v-card-text>
<v-card-actions>
<v-btn text color="primary" v-on:click="close">
Done
</v-btn>
</v-card-actions>
</v-card>
<v-card v-if="step == 'error'" key="error">
<v-card-title>
<translate>
Installation Failed
</translate>
</v-card-title>
<v-card-text class="text--primary">
<translate>Inkscape add-on installation failed</translate>
</v-card-text>
<v-card-text class="text--secondary">
{{ error }}
</v-card-text>
<v-card-actions>
<v-btn text color="primary" v-on:click="retry">
<translate>Try again</translate>
</v-btn>
<v-btn text color="primary" v-on:click="close">
<translate>Cancel</translate>
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script>
const inkStitch = require("../../lib/api")
export default {
name: "InstallPalettes",
data: function () {
return {
path: null,
installing: false,
step: "pick",
error: null
}
},
methods: {
install() {
this.installing = true
inkStitch.post('install/palettes', {path: this.path.path || this.path.name}).then(response => {
this.step = "done"
}).catch(error => {
this.step = "error"
this.error = error.response.data.error
}).then(() => {
this.installing = false
})
},
close() {
window.close()
},
retry() {
this.installing = false
this.step = "pick"
}
},
created: function () {
inkStitch.get("install/default-path").then(response => {
this.path = new File([""], response.data, {})
})
}
}
</script>
<style scoped>
</style>
|