added code samples; fixed color load bug

This commit is contained in:
itdominator 2023-10-23 00:00:01 -05:00
parent f3e808b839
commit cd8ed222ae
4 changed files with 146 additions and 21 deletions

View File

@ -73,18 +73,22 @@ class ListSignalsMixin:
# handle foreground and background colors
if this_style.foreground:
self.fr_color_btn.set_color(Gdk.color_parse(this_style.foreground))
self.fr_color_btn.set_sensitive(True)
self.fr_check_btn.set_active(True)
color = Gdk.color_parse(this_style.foreground)
if color:
self.fr_color_btn.set_color(color)
self.fr_color_btn.set_sensitive(True)
self.fr_check_btn.set_active(True)
else:
self.fr_color_btn.set_color(self.black_color)
self.fr_color_btn.set_sensitive(False)
self.fr_check_btn.set_active(False)
if this_style.background:
self.br_color_btn.set_color(Gdk.color_parse(this_style.background))
self.br_color_btn.set_sensitive(True)
self.br_check_btn.set_active(True)
color = Gdk.color_parse(this_style.background)
if color:
self.br_color_btn.set_color(color)
self.br_color_btn.set_sensitive(True)
self.br_check_btn.set_active(True)
else:
self.br_color_btn.set_color(self.black_color)
self.br_color_btn.set_sensitive(False)

BIN
src/newton.zip Normal file

Binary file not shown.

View File

@ -188,8 +188,76 @@ samples['html'] = """
# samples['imagej'] = """
# samples['ini'] = """
# samples['java'] = """
# samples['js'] = """
# samples['json'] = """
samples['js'] = """
const loadBackground = () => {
const bgElm = document.getElementById("bg");
const bgPath = getCookie('bgSlug');
if (!bgPath) {
const path = '/static/imgs/backgrounds/background.png';
setCookie('bgSlug', path);
setBackgroundElement(bgElm, path);
} else {
// NOTE: Probably in IFRAME and unloaded the background...
if (!bgElm) return ;
setBackgroundElement(bgElm, bgPath);
}
}
"""
samples['json'] = """
{
"load_defaults":false,
"config":{
"base_of_home":"",
"hide_hidden_files":"true",
"thumbnailer_path":"ffmpegthumbnailer",
"blender_thumbnailer_path":"",
"go_past_home":"true",
"lock_folder":"false",
"locked_folders":[
"venv",
"flasks"
],
"mplayer_options":"-quiet -really-quiet -xy 1600 -geometry 50%:50%",
"remux_folder_max_disk_usage":"8589934592",
"make_transparent":0,
"main_window_x":2288,
"main_window_y":199,
"main_window_min_width":720,
"main_window_min_height":480,
"main_window_width":800,
"main_window_height":600,
"application_dirs":[
"/usr/share/applications",
"/home/abaddon/.local/share/applications"
]
},
"filters":{
"meshs":[
".blend",
".dae",
".fbx",
".gltf",
".obj",
".stl"
],
"code":[
".cpp",
".css",
".c",
".go",
".pom"
]
},
"debugging":{
"ch_log_lvl":10,
"fh_log_lvl":20.0,
"target_file": null,
"is_debugging": true
}
}
"""
# samples['latex'] = """
# samples['libtool'] = """
# samples['lua'] = """
@ -212,8 +280,12 @@ samples['html'] = """
# samples['perl'] = """
samples['php'] = """
<?php
/* ygtyuy */
print 'hello world';
>
"""
# samples['pkgconfig'] = """
# samples['prolog'] = """
@ -236,6 +308,23 @@ samples['python'] = """
# TODO handle case where there is a permissions issue
"""
samples['python3'] = """
def on_save_clicked(self, param):
if not self.currentSchemeFile:
filename = runSaveAsDialog(self.window, self.entryId.get_text() + '.xml')
if filename and not '.' in os.path.basename(filename):
filename = filename + '.xml'
if filename:
self.write_scheme(filename, self.entryId.get_text())
self.currentSchemeFile = filename
else:
self.write_scheme(self.currentSchemeFile, self.entryId.get_text())
# TODO handle case where there is a permissions issue
"""
# samples['r'] = """
# samples['rpmspec'] = """
# samples['ruby'] = """
@ -253,6 +342,31 @@ samples['python'] = """
# samples['vbnet'] = """
# samples['verilog'] = """
# samples['vhdl'] = """
# samples['xml'] = """
samples['xml'] = """
{% if current_directory %}
<nav class="navbar navbar-dark bg-dark navbar-expand-lg justify-content-center text-center fixed-bottom">
<div class="container-fluid">
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarTogglerFooter"
aria-controls="navbarTogglerFooter" aria-expanded="false" aria-label="Toggle Footer Navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div id="navbarTogglerFooter" class="row collapse navbar-collapse">
<ul class="navbar-nav">
<li class="nav-item mx-3">
<span id="tggl-faves-btn" class="btn btn-secondary btn-sm" title="Add/Delete from favorites..." >&#9734;</span>
</li>
<li class="nav-item mx-auto">
<span id="path">{{current_directory}}</span>
</li>
</ul>
</div>
</div>
</nav>
{% endif %}
"""
# samples['xslt'] = """
# samples['yacc'] = """

View File

@ -640,20 +640,27 @@
</packing>
</child>
<child>
<object class="GtkSourceView" id="src_preview">
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="left-margin">2</property>
<property name="right-margin">2</property>
<property name="monospace">True</property>
<property name="show-line-numbers">True</property>
<property name="show-line-marks">True</property>
<property name="auto-indent">True</property>
<property name="insert-spaces-instead-of-tabs">True</property>
<property name="show-right-margin">True</property>
<property name="smart-home-end">always</property>
<property name="highlight-current-line">True</property>
<property name="smart-backspace">True</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkSourceView" id="src_preview">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="left-margin">2</property>
<property name="right-margin">2</property>
<property name="monospace">True</property>
<property name="show-line-numbers">True</property>
<property name="show-line-marks">True</property>
<property name="auto-indent">True</property>
<property name="insert-spaces-instead-of-tabs">True</property>
<property name="show-right-margin">True</property>
<property name="smart-home-end">always</property>
<property name="highlight-current-line">True</property>
<property name="smart-backspace">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>