css is not rendered properly - css

I'm trying to build a progress bar component where I want to achieve a specific design for that, as you can see how I tried it in this codesandbox link:
https://codesandbox.io/s/determined-lamport-7zjvwj.
I want to achieve the following behavior:
Initially, all dots should be blue except the first one which is rounded in blue.
I want to keep the dots in the progress bar when I change the properties into blue if the percentage didn't cover them otherwise white
But somehow my CSS calculation is not working properly as expected which I believe I missed something, so any ideas?

there is an error in line 60 et 61
const current = steps.indexOf(stepStatus); // issue here probably
const step = steps.indexOf(stepStatus); // issue here probably
should be:
const current = steps.indexOf(progressBarStatus);
const step = steps.indexOf(stepStatus)
In addition to this problem the width of the pourcentages is not accurate, you can fix this by changing the line 51 with:
const progressBarCalculatedWith =
((current / (getIntermediarySteps + 1)) * 100) + (steps.length -1 - current);
this is the result :
working progress bar

Simply use the same calculation that calculates the % for the loading bar, then apply it ont he dots - So that if the value is 25% or more, then the first dot is blue, then an additional 25% and so on etc. It does not have to be interconnected with the rest of the loading bar, it can use the same calculation.
Simply an If / Else basically.

Related

How do I scale a Mobject using a Manim updater?

I can scale a Square mobject as follows with self.play()/Scene.play():
square = Square(fill_color=RED, fill_opacity=1)
self.play(square.animate.scale(3))
self.wait(3)
But I cannot achieve the scale behaviour as above using this simple add_updater method. All I get is a blank screen:
square = Square(fill_color=RED, fill_opacity=1)
def scale_up(mob, dt):
mob.scale(2*dt)
square.add_updater(scale_up)
self.add(square)
self.wait(3)
Questions
How can I achieve the behaviour of No 1 above with add_updater, or other updater techniques?
I know that I can successfully animate an item with updater methods - such as doing mobject.shift() - even without using self.play()/Scene.play(). Can the behaviour of No. 1 above be achieved without using the Scene.play() method?
It appears that you can .scale() an object with scene updaters, instead of Mobject updaters. Why?

Auto-generating widgets in awesome-wm

So what I currently want to do is pretty much implement rofi in awesome.
The reason I want to do this and I don't just use rofi is because I want to learn how to 'auto-generate' widgets in awesome.
This will come in handy later when I'll implement things like network widgets that when clicked, shows you a panel, shows you the wifi hotspots available as rows, etc etc. So it's just for me to learn how awesome works better. But also, I want a program launcher.
And also, before someone suggests it, I already know that there's a built-in launcher in awesome, and I also know that there's this. This is not what I'm looking for. I want to have the same thing thing rofi and dmenu have: I want to have suggestions pop up when you press keys. and I want to be able to click on the suggestions, etc.
What I want is something like this: uhhhh
So what I'm having problems is this: how do I auto-generate the rows? I want to be able to specify in only one place how many rows I want, and have awesome do the rest.
I've looked through Elv's github and I found radical and even though what he made is a menu system, I thought that I could use some of his code to do what I want. But I can't for the love of god figure out how it works. No offense to him, but it's not all too well docummented, even for users, and for actually explaining how the code works there's no docummentation.
So My question is: How can I make this work? How would I go about making the widgets that act as the rows automatically?
TL;DR:
i want to write a program launcher like rofi in awesome
i want to be able to specify only in one place the number of rows
therefore, (((I think))) I need to automatically generate widgets as rows somehow, how can I do it?
EDIT:
What I want is to be able to create the rows of my launcher automatically. I know I can hardcode the rows myself, have each row have a different id and then I can write a function that on each keypress, will update each widget with the most relevant matches. So it would be something like (not tested at all):
local wibox = require("wibox")
local awful = require("awful")
local num_rows = 10
local row_height = 40
-- set the height of the background in accordance to how many rows there are,
-- and how high each row should be
local prompt_height = row_height * num_rows
local prompt_width = 300
-- make a widget in the middle of the screen
local background = wibox({
x = awful.screen.focused().geometry.width / 2 - prompt_width / 2,
y = awful.screen.focused().geometry.height / 2 - prompt_height / 2,
width = prompt_width,
height = prompt_height,
bg = "#111111",
visible = false,
ontop = false
})
local rofi_launcher = wibox.widget({
widget = background,
{
-- get a flexible layout so the searchbox and the suggestion boxes get
-- scaled to take up all the space of the background
layout = wibox.layout.flex.vertical,
{ -- the prompt you actually type in
-- set id here so we can adjust its ratio later, so the magnifying
-- glass will end up on the right, and the texbox will take up the left side
id = "searchbox_and_mangifying_glass",
layout = wibox.layout.ratio.horizontal,
{
-- set id so we can use it as a prompt later
id = "searchbox",
widget = wibox.widget.textbox,
},
{
widget = wibox.widget.imagebox,
icon = '~/path/to/magnifying_glass_icon.svg',
},
},
{ -- this is where I actually create the rows that will display suggestions
{ -- row number 1
-- make a background for the textbox to sit in, so you can change
-- background color later for the selected widget, etc etc.
widget = wibox.widget.background,
{
-- give it an id so we can change what's displayed in the
-- textbox when we press keys in the prompt
id = "suggestion_1",
widget = wibox.widget.textbox,
},
},
{ -- row number 2
-- background, again
widget = wibox.widget.background,
{
-- id and textbox again
id = "suggestion_2",
widget = wibox.widget.textbox,
},
},
-- and another 8 (according to the `num_rows` variable) of the same two
-- textboxes above. This is exactly my problem. How can I make these
-- textboxes automatically and still be able to interact with them to
-- display suggestions on the fly, as the user types keys into the prompt?
},
},
})
If this is not clear enough please do let me know what you don't understand and I will update my question.
Equally untested as your code, but this creates a tables of textboxes instead of using the declarative layout to create all these textboxes:
[SNIP; For shorter code I removed some stuff at the beginning]
local textboxes = {}
local widgets = {}
for i = 1, num_rows do
local tb = wibox.widget.textbox()
local bg = wibox.widget.background(tb)
bg:set_bg("#ff0000") -- The original code did not set a bg color, but that would make the bg widget useless...?
tb.id = "suggestion_" .. tostring(i) -- This is likely unnecessary, but the original code set these IDs, too
table.insert(textboxes, tb)
table.insert(widgets, bg)
end
local rofi_launcher = wibox.widget({
widget = background,
{
-- get a flexible layout so the searchbox and the suggestion boxes get
-- scaled to take up all the space of the background
layout = wibox.layout.flex.vertical,
{ -- the prompt you actually type in
[SNIP - I did not change anything here; I only removed this part to make the code shorter]
},
widgets
},
})
-- Now make the textboxes display something
textboxes[3].text = "I am the third row"
textboxes[5].text = "I am not"

Split screens with ALV Grid and Tabstrip control

I would like to ask about proper way to split following screens in ALV:
1st screen with type CL_GUI_ALV_GRID
2nd screen is subscreen with Tab strip control
Using docker there are issues with resizing of screen during the runtime. I am not able to provide ratio for both screen.
Is there a way to use CL_GUI_SPLITTER_CONTAINER also for the screen with Tab strip control ?
Thank you !
The following code reacts to a change of the window height. It does not react to a window width, that's a limit of Dynpro, so most of time it will react to Windows buttons minimize and restore, unless the window is the exact half left or half right of the monitor (combined keys Windows+Left and Windows+Right). SY-SCOLS and SY-SROWS are the only way I know to get the window size when a dynpro screen is displayed, but probably there are other ways.
DATA go_docking TYPE REF TO cl_gui_docking_container.
DATA ok_code TYPE syucomm.
DATA ratio TYPE i VALUE 70.
DATA pixels_by_sy_scol TYPE p DECIMALS 2.
CALL SCREEN 100.
MODULE pbo OUTPUT.
IF go_docking IS INITIAL.
CREATE OBJECT go_docking
EXPORTING
repid = sy-repid
dynnr = sy-dynnr
side = cl_gui_docking_container=>dock_at_left
ratio = ratio.
go_docking->get_extension( IMPORTING extension = DATA(extension) ).
cl_gui_cfw=>flush( ). " to calculate the extension (by default in pixels)
pixels_by_sy_scol = extension * 100 / ratio / sy-scols.
ELSE.
go_docking->set_extension( sy-scols * pixels_by_sy_scol * ratio / 100 ).
ENDIF.
ENDMODULE.

Get Geometry of widgets with variable size

Situation
I have a pop_up widget (say a textbox), which I can place arbitrarily on the screen by setting the properties x and y accordingly.
On the other hand I use the prompt, which is located in the default wibar.
I would like to place the pop_up widget directly below the prompt
Problem
I was not yet able to gather any useful information about the geometry of the prompt. With geometry I mean its x and y values together with its height and width. I solved the y-positioning by using the height of the wibar itself.
But I am stuck with x-positioning.
Is there a way to get the width of the widgets within the toolbar?
Notice
I read something about forced_width, but in this situation it sounds like a hack to me. So I would prefer to avoid forcing any widths.
I'm currently running awesome WM 4.2 on Fedora 26
Part of a problem is that "a" widget does not have a position and size since awesome allows widgets to be shown in multiple places at once. However, if we just ignore this problem, something like the following could work (to be honest: I did not test this):
function find_widget_in_wibox(wb, widget)
local function find_widget_in_hierarchy(h, widget)
if h:get_widget() == widget then
return h
end
local result
for _, ch in ipairs(h:get_children()) do
result = result or find_widget_in_hierarchy(ch, widget)
end
return result
end
local h = wb._drawable._widget_hierarchy
return h and find_widget_in_hierarchy(h, widget)
end
However, I have to warn you that the above could break in newer versions of awesome since it access non-public API (the part with wb._drawable._widget_hierarchy). There is a way to work with just the public API using :find_widgets(), but I am too lazy for that for now.
The above function gets the wibox.hierarchy instance representing a widget which allows to get the geometry of the prompt via something like the following (in the default config of awesome 4.2):
local s = screen.primary -- Pick a screen to work with
local h = find_widget_in_wibox(s.mywibox, s.mypromptbox)
local x, y, width, height = h:get_matrix_to_device()
:transform_rectangle(0, 0, h:get_size())
local geo = s.mywibox:geometry()
x, y = x + geo.x, y + geo.y
print(string.format("The widget is inside of the rectangle (%d, %d, %d, %d) on the screen", x, y, width, height)
Finally, note that the widget hierarchy is only updated during repaints. So, during startup the code above will fail to find the widget at all and right after something changed (e.g. you entered another character into the promptbox), the above will still "figure out" the old geometry.

Console not showing up on Xcode Playground 7.1.1

This is what Standard Editor looks like:
This is what Assistant Editor looks like:
This is a problem because whether I click on the eye icon or the + next to (6 times), it shows me a graph only: I was wondering if there would be a way to show more useful output?
Edit: When I show the debug area, it doesn't show any output there:
You can access the console by the menu
View > Debug Area > Show Debug Area
There's also a little upper arrow icon in the bottom left of the Playground, and the SHIFT+CMD+Y shortcut.
In the console you will be able to see not only the error messages but also anything you print.
To be able to see the output in the preview panel you have to place the statement you want to see on a separate line, and break down the logic on separate lines up to some point.
In your case, for example:
let arr = [1,2,3,4,5]
let triple = arr.map({
(i:Int) -> Int in
return i*3
})
Here with let triple ... not being on the same line as the closure anymore, the Playground is able to preview it.
And by clicking on the + on the right side, you can now unfold the special panel where all values are visible:

Resources