I'm having a hard time making the icons from my application visible when the it runs. I've tried everything I could search, and still I don't know what could be wrong. My current dir looks like:
myapp/
├─ main.py
├─ icons_rc.py
├─ ui_window.py
├─ window.ui
├─ icons.qrc
├─ icons/
│ ├─ icon1.png
| ├─ ...
| ├─ iconN.png
The icons_rc.py file was generated with the command pyrcc5 icons.qrc -o icons_rc.py and it's imported to both the main.py and ui_window.py.
The icons.qrc file was generated in QtDesigner as the following:
<RCC>
<qresource prefix="/">
<file>icons/icon1.png</file>
...
<file>icons/iconN.png</file>
</qresource>
</RCC>
I've tried generating the .qrc file again, putting it inside the icons folder, changing the prefix of the file, and looked extensively into tutorials on how to do it step-by-step and still I have no clue what I'm doing wrong.
After some months ignoring this particular problem from my project, I finally was able to solve it! What I did was to add the "icons" part to the prefix, and used pyside-rcc to convert the .qrc file into a icons_rc.py, following a tutorial from PyQt's documentation page
Related
I want to use sass to write individual components, for example styling a chart. But I don't want to manually include every component, but rather have one scss file that includes all the components and then gets compiled to one .css file that I can include. I found this SO answer but it didn't work for me and according to SASS, you're not supposed to use #import anymore. This is the project structure:
src/
├─ about/
│ ├─ .../
│ ├─ scss/
│ │ ├─ chart.scss/
├─ app/
│ ├─ scss/
├─ build/
│ ├─ css/
| | ├─ styles.css
├─ base/
│ ├─ styles.scss
styles.scss should include all scss files from all projects in the src, and should be compiled on every .scss save. When I do it with this command though:
sass base/styles.scss:build/css/main.css --watch --style=compressed --no-source-map
it gives the error:
Error: Can't find stylesheet to import.
╷
1 │ #use "//about/scss/chart.scss";
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
╵
base_templates\styles.scss 1:1 root stylesheet
The content of styles.scss is
#use "//about/scss/chart.scss";
and that of chart.scss:
h1 {
color: #fff;
}
(as a test). What am I doing wrong?
The path should be "/src/about/scss/chart.scss" for Sass if src is the source of the volume respectively partition. Sass never 'knows' anything about your domain or network, therefore you can't assume that you can use paths based on the webroot as absolute paths.
You can also consider using relative paths, then it would be '../about/scss/chart.scss'.
I have files as follows:
assets/
├─ icon_1.png
├─ icon_1#2x.png
├─ icon_1#3x.png
├─ icon_2.png
├─ icon_2#2x.png
├─ icon_2#3x.png
and I want to change it to this format:
assets/
├─ icon_1/
│ ├─ 3.0x/
│ │ ├─ icon_1.png
│ ├─ 2.0x/
│ │ ├─ icon_1.png
│ ├─ icon_1.png
├─ icon_2/
│ ├─ 3.0x/
│ │ ├─ icon_2.png
│ ├─ 2.0x/
│ │ ├─ icon_2.png
I am trying to use zmv commands such as
zmv '(*).png' $1/'$1.png'
or
zmv '(*).png' '$1/$1.png'
to get a feel of how it works. However, it tells me that I do not have the right directories. Is there a way to create directories dynamically from the file names?
I wasn't really able to find a way to parametrize the suffixes and create the directories dynamically, however I did find a solution for my specific case of the problem.
I ran the following commands on zsh:
for file in *#3x.png
do
dirname="${file%#3x.png}" #this truncates the #3x.png from 'icon_1#3x.png' and so on
mkdir "$dirname"
mkdir "$dirname/2.0x"
mkdir "$dirname/3.0x"
done
This creates the folder structures that I want. Now I only have to move the files from ./ to the desired directories as follows:
zmv '(*)#3x.png' '$1/3.0x/$1.png'
zmv '(*)#2x.png' '$1/2.0x/$1.png'
zmv '(*).png' '$1/$1.png'
I move the ones with #3x, #2x suffixes first so they don't get selected by the (*).png selector.
This can be done with zmv, but you may need a somewhat complicated pattern. This will move the files if the destination directories exist:
zmv -n '(icon_<->)(*).png' '${1:r}/${${2##}%x}${2:+.0x}/$1.png'
The -n (no-execute) option is for testing - remove it to actually move the files. The extended glob pattern <-> matches any number; it lets us split the source pattern into two pieces. The destination pattern uses several zsh parameter expansions to build the path, with repeated forward slashes being treated like a single slash for the icon_1 and icon_2 directories.
Out-of-the box, zmv will not create directories, but it will accept a custom command that can call mkdir:
mkdir_mv () {
mkdir -p -- $3:h
mv -- $2 $3
}
zmv -n -p mkdir_mv '(icon_<->)(*).png' '${1:r}/${${2##}%x}${2:+.0x}/$1.png'
The mkdir_mv code is from this answer.
I learned of a way to run julia, so I can use the file structure of a package for my project.
Namely julia --project inside my developement directory. With this I can load all projects structured like projectName/src/projectName.jl inside the same folder.
An Example:
all my julia projects/
├─ project 1/
│ ├─ working with files in julia.jl
│ ├─ data.csv
├─ project 2/
│ ├─ project.toml
│ ├─ src/
│ │ ├─ project 2.jl
├─ project 3/
│ ├─ draft.uxf
│ ├─ .gitignore
│ ├─ project.toml
│ ├─ auto_compile.jl
│ ├─ src/
│ │ ├─ project 3.jl
With this file structure I want to call auto_compile.jl that does the following:
using Pkg
cd("..")
Pkg.activate(".")
Pkg.instatiate()
Pkg.add("PackageCompiler")
using PackageCompiler
create_app("Project 3", "Project 3 Compiled")
However, PackageCompiler.jl only works with the --project command. The --project argument doesnt seem to modify LOAD_PATH, what does it do exactly? Can I edit my julia session with --project later on? I figured julia does the same when loading packages from the ~user/.julia/packages/ dir, but how do I do that, and are there more usefull arguments I should know about?
after some quick "testing" I can confirm:
the --project/--project=. flags when starting julia from the terminal do the same as Pkg.activate(".")
Is there someone who can explain in detail the standard used by Symfony* to name folders and files in the directory structure?
MyBundle
├─ Controller/ <-- 1) why singular?
├─ Model/ <-- 2) why singular?
├─ Resources/ <-- 3) why plural?
│ ├─ config/ <-- 4) why the "c" is lowercase?
│ ├─ translations/
│ ├─ views/ <-- 5) why the "v" is lowercase and views is plural?
│ │ └─ Default/ <-- 6) Why uppercase?
│ │ └─ my_view.html.twig <-- 7) Why lowercase and snake case?
│ └─ public/
├─ Service/ <-- 8) why singular?
└─ Tests/
This leads to another question: if I want to create a folder which contains ArchiveSection classes inside the Model folder, how should I name it?
Model/ArchiveSections/
Model/ArchiveSection/
Model/archive_sections/
* I am using Symfony 2.3.
See the docs talking about bundle directory structure.
I would say just keep in mind that the Resources directory structure must follow the standards to get some automatic registration of view paths and translations files in the kernel. The same applies to the Command directory.
For the rest it's how you want it to be, just know that the directory structure should repeat the symfony components structure to keep logic and readability (a Twig directory for creating twig extensions or functions, a Serializer directory to hold custom normalizers...).
This is relevant to have a good directory structure as it defines your classes namespace structure.
There is no strictly rules for structure and architecture directory in symfony framework. But exist best practices and standard convention.
In your case, there is nothing issue and you can do what do you want.
It seems that underscore in name directory is not very standard convention but not mandatory.
For question deal with singular or plurial it seems that is unanswered convention from symfony developers. Example : Me I name my service directory with plurial like this 'services' and all my code run perfectly with this name.
Hie everyone !
My Sass project looks like this :
Project
├── sass/
│ ├── bootstrap/
│ │ ├── ...
│ │ ├── _bootstrap.scss
│ ├── mymodule/
│ │ ├── submodules/
│ │ ├── _mymodule.scss /*with only #import from submodules/ */
| └── main.scss /* various styles & #import bootstrap, mymodule */
└── stylesheets/
└── main.css
I'm trying to watch every modifications:
in the whole mymodule folder
in main.scss
And alterate only stylesheets/main.css with modifications i made.
Every commands I wrote have generate mymodule.css or others scss files/folders.
What is the sass --watch for doing this please ?
Thanks a lot in advance !
Alexis
You should totally use Compass!
What Compass is
Compass is a must-have tool for every SASS coder. Compass consists of two parts:
a meta-framework for SASS;
a command line tool used for compiling Compass projects and doing other useful stuff.
The compass watch command is exactly what you're looking for. It will recompile the CSS whenever you save a change in any of the following:
every non-partial file inside the sass folder (in your case it's only main.scss);
every partial imported by one of the above (recursively).
Partials that are never imported are ignored.
Compass will create a separate CSS file for every non-partial file. As for partials, they do not appear as separate CSS files because are incorporated inside non-partials.
Ridiculously short installation guide
For the following to work, you must have Ruby and RubyGems. Probably you already have them.
To start using Compass, do:
Install Compass with RubyGems: gem install compass.
Create a compass.rb file in the root of your project (in your case it's Project/compass.rb).
Run compass watch and start coding.
Example of a config.rb file
Here's a minimal compass.rb that might work for you:
css_dir = "stylesheets"
sass_dir = "sass"