forked from MariwanJ/Design456
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Design456Pref.py
75 lines (64 loc) · 3.38 KB
/
Design456Pref.py
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
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
#
# ***************************************************************************
# * *
# * This file is a apart of the Open Source Design456 Workbench - FreeCAD. *
# * *
# * Copyright (C) 2021 *
# * *
# * *
# * This library is free software; you can redistribute it and/or *
# * modify it under the terms of the GNU Lesser General Public *
# * License as published by the Free Software Foundation; either *
# * version 2 of the License, or (at your option) any later version. *
# * *
# * This library is distributed in the hope that it will be useful, *
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
# * Lesser General Public License for more details. *
# * *
# * You should have received a copy of the GNU Lesser General Public *
# * License along with this library; if not, If not, see *
# * <http://www.gnu.org/licenses/>. *
# * *
# * Author : Mariwan Jalal [email protected] *
# ***************************************************************************
import os,sys
import FreeCAD as App
import FreeCADGui as Gui
import Design456Init
import FACE_D as faced
from PySide.QtCore import QT_TRANSLATE_NOOP
from PySide import QtGui, QtCore
from draftutils.translate import translate #for translate
#There are several preferences that must be registered somewhere
#For example simplecopy of extruded object, chamfer,..etc
#Originally I wanted to simplify everything. But there are users don't like that.
#This is a start of the preferences pages. Not finished yet.
#TODO : FIXME:
__updated__ = '2022-02-08 20:28:39'
from PySide import QtGui
def Design456_preferences():
return Gui.ParamGet("User parameter:BaseApp/Preferences/Mod/Design456")
def setGrid(enabled=True):
pref = Design456_preferences()
pref.SetBool("GridEnabled", enabled)
def setSimplified(enabled=False):
pref = Design456_preferences()
pref.SetBool("Simplified", enabled)
class Design456Preferences:
def __init__(self, parent=None):
self.form = Gui.PySideUic.loadUi(Design456Init.UI_PATH+'Design456Pref.ui')
def saveSettings(self):
Design456_preferences().setPreferencesAdvanced(
self.form.chkDisableGrid.isChecked(),
self.form.chkSimplify.isChecked()
)
def loadSettings(self):
self.form.chkDisableGrid.setChecked(Design456Init.PATH_PREF.chkDisableGrid())
self.form.chkSimplify.setChecked(Design456Init.PATH_PREF.chkSimplify())
self.updateSelection()
def updateSelection(self, state=None):
pass
Gui.addPreferencePage(Design456Preferences,"Design456")