Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
Printrun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
Printrun
Commits
fba262be
Commit
fba262be
authored
Jul 26, 2011
by
Keegi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Options dialog
parent
64fd8aeb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
2 deletions
+28
-2
pronsole.py
pronsole.py
+3
-1
pronterface.py
pronterface.py
+25
-1
No files found.
pronsole.py
View file @
fba262be
...
@@ -64,6 +64,8 @@ class Settings:
...
@@ -64,6 +64,8 @@ class Settings:
except
AttributeError
:
except
AttributeError
:
pass
pass
return
[]
return
[]
def
_all_settings
(
self
):
return
dict
([(
k
,
getattr
(
self
,
k
))
for
k
in
self
.
__dict__
.
keys
()
if
not
k
.
startswith
(
"_"
)])
class
pronsole
(
cmd
.
Cmd
):
class
pronsole
(
cmd
.
Cmd
):
def
__init__
(
self
):
def
__init__
(
self
):
...
@@ -259,7 +261,7 @@ class pronsole(cmd.Cmd):
...
@@ -259,7 +261,7 @@ class pronsole(cmd.Cmd):
except
AttributeError
:
except
AttributeError
:
print
"Unknown variable '
%
s'"
%
var
print
"Unknown variable '
%
s'"
%
var
except
ValueError
as
ve
:
except
ValueError
as
ve
:
print
"Bad value for variable '
%
s', expecting
"
%
var
,
str
(
t
)[
1
:
-
1
],
"(
%
s)"
%
ve
.
args
[
0
]
print
"Bad value for variable '
%
s', expecting
%
s (
%
s)"
%
(
var
,
repr
(
t
)[
1
:
-
1
],
ve
.
args
[
0
])
def
do_set
(
self
,
argl
):
def
do_set
(
self
,
argl
):
args
=
argl
.
split
(
None
,
1
)
args
=
argl
.
split
(
None
,
1
)
...
...
pronterface.py
View file @
fba262be
...
@@ -267,6 +267,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
...
@@ -267,6 +267,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
self
.
macros_menu
=
wx
.
Menu
()
self
.
macros_menu
=
wx
.
Menu
()
m
.
AppendSubMenu
(
self
.
macros_menu
,
"&Macros"
)
m
.
AppendSubMenu
(
self
.
macros_menu
,
"&Macros"
)
self
.
Bind
(
wx
.
EVT_MENU
,
self
.
new_macro
,
self
.
macros_menu
.
Append
(
-
1
,
"<&New...>"
))
self
.
Bind
(
wx
.
EVT_MENU
,
self
.
new_macro
,
self
.
macros_menu
.
Append
(
-
1
,
"<&New...>"
))
self
.
Bind
(
wx
.
EVT_MENU
,
lambda
*
e
:
options
(
self
),
m
.
Append
(
-
1
,
"&Options"
,
" Options dialog"
))
self
.
menustrip
.
Append
(
m
,
"&Settings"
)
self
.
menustrip
.
Append
(
m
,
"&Settings"
)
self
.
update_macros_menu
()
self
.
update_macros_menu
()
self
.
SetMenuBar
(
self
.
menustrip
)
self
.
SetMenuBar
(
self
.
menustrip
)
...
@@ -950,7 +951,7 @@ class macroed(wx.Dialog):
...
@@ -950,7 +951,7 @@ class macroed(wx.Dialog):
"""Really simple editor to edit macro definitions"""
"""Really simple editor to edit macro definitions"""
def
__init__
(
self
,
macro_name
,
definition
,
callback
):
def
__init__
(
self
,
macro_name
,
definition
,
callback
):
self
.
indent_chars
=
" "
self
.
indent_chars
=
" "
wx
.
Dialog
.
__init__
(
self
,
None
,
title
=
"macro
%
s"
%
macro_name
)
wx
.
Dialog
.
__init__
(
self
,
None
,
title
=
"macro
%
s"
%
macro_name
,
style
=
wx
.
DEFAULT_DIALOG_STYLE
|
wx
.
RESIZE_BORDER
)
self
.
callback
=
callback
self
.
callback
=
callback
self
.
panel
=
wx
.
Panel
(
self
,
-
1
)
self
.
panel
=
wx
.
Panel
(
self
,
-
1
)
titlesizer
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
titlesizer
=
wx
.
BoxSizer
(
wx
.
HORIZONTAL
)
...
@@ -1002,6 +1003,29 @@ class macroed(wx.Dialog):
...
@@ -1002,6 +1003,29 @@ class macroed(wx.Dialog):
reindented
+=
self
.
indent_chars
+
line
+
"
\n
"
reindented
+=
self
.
indent_chars
+
line
+
"
\n
"
return
reindented
return
reindented
class
options
(
wx
.
Dialog
):
"""Options editor"""
def
__init__
(
self
,
pronterface
):
wx
.
Dialog
.
__init__
(
self
,
None
,
title
=
"Edit settings"
)
topsizer
=
wx
.
BoxSizer
(
wx
.
VERTICAL
)
vbox
=
wx
.
StaticBoxSizer
(
wx
.
StaticBox
(
self
,
label
=
"Defaults"
),
wx
.
VERTICAL
)
topsizer
.
Add
(
vbox
,
1
,
wx
.
ALL
+
wx
.
EXPAND
)
grid
=
wx
.
GridSizer
(
rows
=
0
,
cols
=
2
,
hgap
=
8
,
vgap
=
2
)
vbox
.
Add
(
grid
,
0
,
wx
.
EXPAND
)
ctrls
=
{}
for
k
,
v
in
pronterface
.
settings
.
_all_settings
()
.
items
():
grid
.
Add
(
wx
.
StaticText
(
self
,
-
1
,
k
),
0
,
wx
.
BOTTOM
+
wx
.
RIGHT
)
ctrls
[
k
]
=
wx
.
TextCtrl
(
self
,
-
1
,
str
(
v
))
grid
.
Add
(
ctrls
[
k
],
1
,
wx
.
EXPAND
)
topsizer
.
Add
(
self
.
CreateSeparatedButtonSizer
(
wx
.
OK
+
wx
.
CANCEL
),
0
,
wx
.
EXPAND
)
self
.
SetSizer
(
topsizer
)
topsizer
.
Layout
()
topsizer
.
Fit
(
self
)
if
self
.
ShowModal
()
==
wx
.
ID_OK
:
for
k
,
v
in
pronterface
.
settings
.
_all_settings
()
.
items
():
if
ctrls
[
k
]
.
GetValue
()
!=
str
(
v
):
pronterface
.
set
(
k
,
str
(
ctrls
[
k
]
.
GetValue
()))
self
.
Destroy
()
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
app
=
wx
.
App
(
False
)
app
=
wx
.
App
(
False
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment