Theme packer
This commit is contained in:
parent
26b1fad5a4
commit
7fb5c8a378
|
@ -12,6 +12,7 @@
|
||||||
<Card :item="theme">
|
<Card :item="theme">
|
||||||
<SettingSwitch slot="toggle" :value="theme.enabled" @input="$emit('toggle-theme')" />
|
<SettingSwitch slot="toggle" :value="theme.enabled" @input="$emit('toggle-theme')" />
|
||||||
<ButtonGroup slot="controls" v-if="!online">
|
<ButtonGroup slot="controls" v-if="!online">
|
||||||
|
<Button v-if="devmode && !theme.packed" v-tooltip="'Package Theme'" @click="package"><MiBoxDownload size="18" /></Button>
|
||||||
<Button v-tooltip="'Settings (shift + click to open settings without cloning the set)'" v-if="theme.hasSettings" @click="$emit('show-settings', $event.shiftKey)"><MiSettings size="18" /></Button>
|
<Button v-tooltip="'Settings (shift + click to open settings without cloning the set)'" v-if="theme.hasSettings" @click="$emit('show-settings', $event.shiftKey)"><MiSettings size="18" /></Button>
|
||||||
<Button v-tooltip="'Recompile (shift + click to reload)'" @click="$emit('reload-theme', $event.shiftKey)"><MiRefresh size="18" /></Button>
|
<Button v-tooltip="'Recompile (shift + click to reload)'" @click="$emit('reload-theme', $event.shiftKey)"><MiRefresh size="18" /></Button>
|
||||||
<Button v-tooltip="'Edit'" @click="editTheme"><MiPencil size="18" /></Button>
|
<Button v-tooltip="'Edit'" @click="editTheme"><MiPencil size="18" /></Button>
|
||||||
|
@ -22,17 +23,33 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// Imports
|
// Imports
|
||||||
|
import { Toasts } from 'ui';
|
||||||
|
import { Settings, ThemeManager } from 'modules';
|
||||||
|
import { ClientLogger as Logger } from 'common';
|
||||||
import { shell } from 'electron';
|
import { shell } from 'electron';
|
||||||
import Card from './Card.vue';
|
import Card from './Card.vue';
|
||||||
import { Button, ButtonGroup, SettingSwitch, MiSettings, MiRefresh, MiPencil, MiDelete, MiExtension } from '../common';
|
import { Button, ButtonGroup, SettingSwitch, MiSettings, MiRefresh, MiPencil, MiDelete, MiExtension, MiBoxDownload } from '../common';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
devmode: Settings.getSetting('core', 'advanced', 'developer-mode').value
|
||||||
|
}
|
||||||
|
},
|
||||||
props: ['theme', 'online'],
|
props: ['theme', 'online'],
|
||||||
components: {
|
components: {
|
||||||
Card, Button, ButtonGroup, SettingSwitch,
|
Card, Button, ButtonGroup, SettingSwitch,
|
||||||
MiSettings, MiRefresh, MiPencil, MiDelete, MiExtension
|
MiSettings, MiRefresh, MiPencil, MiDelete, MiExtension, MiBoxDownload
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
async package() {
|
||||||
|
try {
|
||||||
|
const packagePath = await ThemeManager.packContent(this.theme.name, this.theme.contentPath);
|
||||||
|
Toasts.success(`Theme Packaged: ${packagePath}`);
|
||||||
|
} catch (err) {
|
||||||
|
Logger.log('ThemeCard', err);
|
||||||
|
}
|
||||||
|
},
|
||||||
editTheme() {
|
editTheme() {
|
||||||
try {
|
try {
|
||||||
shell.openItem(this.theme.contentPath);
|
shell.openItem(this.theme.contentPath);
|
||||||
|
|
Loading…
Reference in New Issue