maxscript slider, read value - rendering

I have two sliders and I need use his value in Rendering...
Definition:
slider maximum "xxxx" orient:#horizontal type:#integer range:[0,10,10]
slider minimum "xxxx" orient:#horizontal type:#integer range:[0,10,0]
Use:
myanim = render camera:$Camera001 fromframe:minimum.val*30 toframe:maximum.val*30 outputfile:myoutput
I need use values from sliders... I try .val, .value but compilers say"its undefined".
Thanks for answers
I solved it, its:
myanim = render camera:$Camera001 fromframe:(minimum.value*30) toframe:(maximum.value*30) outputfile:myoutput

Related

How do I make my input text wholly visible in PySimpleGUI

enter image description here
How do I get my program using PySimpleGUI to display the whole text information before the input box?
Suppose I have a long sg.Text('abcdefghijklmnopqrst') - All of this text is not being displayed in the window.
Thanks in Advance
Try to use textwrap.wrap
Wraps the single paragraph in text (a string) so every line is at most width characters long. Returns a list of output lines, without final newlines.
Example code
from textwrap import wrap
import PySimpleGUI as sg
def Frame(text, key, width=30):
lines = wrap(text, width=width)
height = len(lines)
new_text = '\n'.join(lines)
layout = [[sg.Text(new_text, size=(width, height)), sg.Input(key=key)]]
return sg.Frame('', layout, pad=(0, 0))
Questions = [
'How often do you use our products?',
'Which features are most valuable to you?',
'How would you compare our products to our competitors?',
'What important features are we missing?',
'What are you trying to solve by using our product?',
'What other types of people could find our product useful?',
'How easy is it to use our product?',
'How would you rate the value for money?',
'How likely are you to recommend this product to others?',
'How could we improve our product to better meet your needs?',
]
font = ('Courier New', 10, 'bold')
sg.set_options(font=font)
sg.theme('DarkBlue3')
layout = [
[Frame(question, f'Q {i}')] for i, question in enumerate(Questions)] + [
[sg.Push(), sg.Button('Submit'), sg.Push()],
]
sg.Window('Product Survey Questions', layout).read(close=True)

LibreOffice API/UNO: How to horizontal right-align text in table cell in writer

I'm using C++ to control LibreOffice/OpenOffice from another application, but I guess you can help me if you know the java-bridge as well. So basically I want to load a document (works), set the text of a cell (works) and set a table-cell to horizontal align right (which I got no idea how to do it):
I do:
// Load Document
Reference <XInterface> rDoc = myLoader->loadComponentFromURL(...);
// Get Table
Reference <XTextTablesSupplier> rTablesSuppl(rDocument, UNO_QUERY);
Any any = rTablesSuppl->getTextTables()->getByName("Table1");
Reference<XTextTable> rTable(any, UNO_QUERY);
// Set Text in cell
Reference<XCellRange> rRange (rTable, UNO_QUERY);
Reference<XCell> rCell = rRange->getCellByPosition(x, y);
Reference<XTextRange> rTextRange(rCell, UNO_QUERY);
rTextRange->setString("MyNewText");
// Align "MyNewText" right
????
Any idea how to continue?
Caveat... While I have experience with C++, I use Java for LO API programming, so the following may be a bit off. You'll probably have to tweak a bit to get things going.
In Java and using the cell name to get the cell, I right-justified text in a cell like this:
XCell xCell = xTextTable.getCellByName(cellname);
XText xText = UnoRuntime.queryInterface(XText.class, xCell);
XPropertySet xPropertySet = UnoRuntime.queryInterface(XPropertySet.class, xText.getStart());
xPropertySet.setPropertyValue("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT);
In C++ and using the cell position to get the cell, I'm thinking that a rough translation would be:
Reference<XCell> rCell = rRange->getCellByPosition(x, y);
Reference<XText> rText(rCell, UNO_QUERY);
Reference< XPropertySet > xPropSet( rText->getStart(), UNO_QUERY );
xPropSet->getPropertyValue("ParaAdjust") >>= com::sun::star::style::ParagraphAdjust.RIGHT;
Given what you've already got, it looks like you might be able to just replace your ???? with something like this:
Reference< XPropertySet > xPropSet( rTextRange, UNO_QUERY );
xPropSet->getPropertyValue("ParaAdjust") >>= com::sun::star::style::ParagraphAdjust.RIGHT;

Update plot according to updated slider value wit Gtk

In Julia, I'd like to update a plot upon the change of value in a Gtk Slider. I understand that this has to do with the "change-value" signal in https://developer.gnome.org/gtk2/2.24/GtkRange.html#GtkRange-value-changed. However, as a beginner, I do not know how to implement the code
The “change-value” signal
gboolean
user_function (GtkRange *range,
GtkScrollType scroll,
gdouble value,
gpointer user_data)
to achieve what I wanted to do. Could anyone kindly provide an example how to use the "change-value" signal?
I know how to set up a window for the slider
sl = slider(1:11)
win = Window("Testing") |> (bx = Box(:v))
push!(bx, sl)
Gtk.showall(win)
I also know what kind of function I need to update the plot
function update(val)
int_val = int(val)
if Signal(sl) != int_val
x = range(0., 2*pi, step=0.01)
y = map(sin, x)
PyPlot.plot(x,Signal(sl)*y)
end
end
However, I don't know how or where I can trigger the "update" function to take actual action.
Thanks!
Thanks, liberforce for your advice!
Here is my minimal working example:
'''
using Gtk
# Set up scale (slider) and window
sl = GtkScale(false, 0:10)
win = Gtk.Window("Gain Selection") |> (bx = Gtk.Box(:v))
push!(bx, sl)
Gtk.showall(win)
# Connect with value-changed signal
id = signal_connect(sl, "value-changed") do widget
# Get scale value
sub = Gtk.GAccessor.adjustment(widget)
val = Gtk.get_gtk_property(sub,"value",Int64)
# Perform function related to the scale value.
println("Gain is changed to ", val)
end
push!(bx, sl)
Gtk.showall(win);
'''
Reference:
signal connect: http://juliagraphics.github.io/Gtk.jl/latest/manual/signals.html
GtkScale: https://lazka.github.io/pgi-docs/Gtk-3.0/classes/Scale.html
Extract scale value: https://discourse.julialang.org/t/how-to-get-the-current-value-of-a-gtk-scale-widget/15680
Julia Do-block: https://www.juliabloggers.com/julia-do-block-vs-python-with-statement/

Ironpython in Spotfire - draw curve and modify chart

I have a code that changes my visualisation type from a Line to a Bar chart based on a property type. I need add a query to draw a straight line based on a property within my visualisation. The code I have so far is this:
from Spotfire.Dxp.Application.Visuals import VisualContent
from Spotfire.Dxp.Application.Visuals import VisualTypeIdentifiers
vc1 = viz1.As[VisualContent]()
Yaxis=vc1.YAxis.Expression
Xaxis=vc1.XAxis.Expression
ColorAxis=vc1.ColorAxis.Expression
if type=="LINE":
viz1.TypeId = VisualTypeIdentifiers.LineChart
if type == "BAR":
viz1.TypeId = VisualTypeIdentifiers.BarChart
vc1.XAxis.Expression=Xaxis
vc1.YAxis.Expression=Yaxis
vc1.ColorAxis.Expression=ColorAxis
Thanks in advance for your help!
from Spotfire.Dxp.Application.Visuals import LineChart
if vis.As[LineChart]().FittingModels[0].Enabled == False:
vis.As[LineChart]().FittingModels[0].Enabled = True
else:
vis.As[LineChart]().FittingModels[0].Enabled = False
This code requires a vis parameter defined as Type: Visualization Value: Page > Line Chart

How to write value to input field

I am getting element with
var nameEl = document.getElementById("<portlet:namespace />kategorijaName");
that is input field.How can i write some text in it ?
Since the question (at this time) is tagged liferay and alloy-ui, I am assuming an answer using/appropriate for those two tags would be beneficial
<aui:input id='textFieldId' name='textFieldName' label='My Text Field'></aui:input>
<script>
AUI().use('node', function(A){
A.one('#<portlet:namespace/>textFieldId').set('value', "A new input value");
});
</script>
if you are using normal javascript then you can use below for setting a value in input text
document.getElementById("<portlet:namespace />kategorijaName").value = 'some value';
in case of Jquery you can use
$("#<portlet:namespace />kategorijaName").val("some value");
If you are using alloy-ui then you can set value like this
<aui:script>
A.one('#<portlet:namespace />kategorijaName').set('value',kategorijaName);
</aui:script>
nameEl.value = "value you need"