How to change the keybindings of atom add-ons? [closed] - atom-editor

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have installed the atom-shortcuts add-on in Atom, but I can't use the shortcut to toggle the cheatsheet because of my keyboard layout, so I would like to change the keybinding for this add-on but I can't find it by name in the keybindings section of Atom. Where can I find the information necessary to change the keybinding of this add-on?

The problem with this particular package is that it doesn't follow the standard way to assign keybindings, i.e. by providing a CSON (or JSON) file inside the /keymaps subfolder. Instead, the package assigns the keybinding programmatically. It also does not register commands that are triggered by keybindings in its activate() method.
Unfortunately, that's a combination that makes it impossible to re-assign keybindings the “Atom way”. Unless you can convince the author to re-implement command registration and keybinding assignment (or fork the package yourself), there's only one last resort: use the same dirty tricks to change the package's behaviour.
You can put the following CoffeeScript snippet in Atom's init script file:
# Get the selector for the atom-shortcuts element
atomShortCuts = document.querySelector "div.atom-shortcuts"
# Assign a custom keydown event
document.body.addEventListener 'keydown', (event) ->
# Pick a shortcut, Ctrl+Shift+S in this example
if event.ctrlKey and event.key is 'S'
atomShortCuts.style.display = 'block'
return
I recommend reading MDN's documentation for KeyboardEvent if you want your keybinding to behave differently. CSS Tricks has a helpful testing tool for keyboard events.

Related

How to create a multiple window GUI in Qt [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I am very new to this, it's my first GUI project. I want to create a GUI in Qt that has multiple windows in which I have buttons that take me from a window to another. Also, across these windows, I will be passing data.
I am using Qt Designer, and I was wondering what would be the best way to do this. Do I create multiple Main Windows for example? Or should they be as Widgets? Or some other way?
Any help would be appreciated.
The main window is one by definition. If you need to create multiple windows however the simplest thing to do is to create a new widget without any parent and show it with show().
QWidget *fstWin = new QWidget(nullptr);
QWidget *scdWin = new QWidget(nullptr);
fstWin->show();
scdWin->show();
https://doc.qt.io/qt-5/application-windows.html
Your question is very basic. Seems you started to learn GUI from the beginning and probably the programming at all.
Anyway, you dont need more than one Main Window. This is where your program starts.
All other windows must be created from the designer. They are Dialogs. To add a new Dialog, you need to click on your project (right pane), and select Add New...
From the dialog, just select QT and then Qt Designer Form Class. Follow the Wizard and set the type and name of the dialog.
Finishing the Wizard, will add you three items in the project with the name you selected: Header File, Source file (.cpp) and Form file (.ui).
To show a the newly created form, you need to #include your .h file in the mainwindow.h then you need to create a member variable of type "your newly created class" in MainWindow class.
To show the new dialog, just use the function .show() from the member variable. To show the dialog in modal state, use the .exec() function of the member variable.
To pass data between windows, you need to make corresponding methods in your newly created class.
But, just before doing all this stuff, I advise you to take some lessons about Object Oriented Programming. You have to know, what is Class, Object, Member and Field/Variable
Or it will be very hard for you learn more.

Form Input Validation with Meteor [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
Meteor doesn't have a built in validation smart package yet. What validation libraries should I consider? What are other people using?
We decided to use simpleSchema with Collection2 and autoform for validation. It's a very sophisticated solution. We save a lot of time using this approach rather than trying to roll each form by hand.
Simply by defining a scheme with validation rules (validation rules are provided automatically for data type and isRequired settings) then creating a form with autoForm (a single line of code) and you get all this for free
An autogenerated form that uses bootstrap3 classes.
Appropriate HTML5 fields for all keys in your collection schema.
A submit button that gathers the entered values and inserts them into your collection.
Form validation based on the schema attached to your collection. By default the form is validated when the user submits. If anything is invalid, the form is continually re-validated on keyup (throttled) as the user fixes the issues.
Default validation error messages that appear under the fields, and can be customized and translated.
meteor-simple-schema
A simple, reactive schema validation smart package for Meteor.
https://github.com/aldeed/meteor-simple-schema
meteor-collection2
A smart package for Meteor that extends Meteor.Collection to provide support for specifying a schema and then validating against that schema when inserting and updating. Also adds support for virtual fields.
https://github.com/aldeed/meteor-collection2
meteor-autoform
A smart package for Meteor that adds UI components and helpers to easily create basic forms with automatic insert and update events, and automatic reactive validation.
https://github.com/aldeed/meteor-autoform
If you want to use meteorite, you can just search through the atmosphere packages to see what's popular. I'm currently using jqBootstrapValidation. In the past I have used validate.js, but right now I prefer to have something with bootstrap integration. I hear parsley.js is popular with the cool kids, though as of this writing there isn't a smart package for it - but that's easy enough to solve.
You already have Tracker as part of Meteor, so I put a little tutorial and JSfiddle together on how to use it to implement a typical form validation scenario.
http://bit.ly/meteor-form-validation-video
http://bit.ly/meteor-form-validation-fiddle

How could you dynamically create a pdf within wordpress? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm using a Contact Form 7 to have the users enter data, then based on their data entry, I need to add different text to the pdf before outputting the entire pdf.
For example, if the user says they like red balloons, the created balloon pdf will mention how important red balloons are, etc...
I know there must be a way to do this using fpdf, tcpdf, or something, but I'm not sure how. Any ideas?
Take a look at dompdf Its is very easy to use as well as good implementation documentation.
You may wish to use PHP's native PDF functions wrapped in a custom Wordpress plugin to generate your own PDF documents. Check out the PHP.net Manual: PDF for an overview. I'm there there are plenty of PHP=>PDF vendor libraries out there if you search the Google's.
Another solution, off the top of my head, would be to run a worker process somewhere to convert and return documents in [?|PDF] formats based on Wordpress data fed through a template system (mustache, twig, etc).
create a child plugin, this guy done it or is doing it: http://wordpress.org/support/topic/plugin-contact-form-7-add-attachment-with-wpcf7_contactform-class?replies=1
First of all I really recommend using Gravity Forms, it's a better plugin for forms and it also saves entries in the database so you can retrieve them.
For the PDF part, I think you need to program it manually.
Create a php file that implements tcpdf, and receives all input from the form (via POST or GET). Then you have all the parameters you need and you can create the PDF in any way you like.
In order to use this php file, open a Page in Wordpress and then rename the php file to page-.php (where XXXX is the new Page ID you opened)
install the pdf creator plugin from this url. Hope this help you.
http://wordpress.org/extend/plugins/kalins-pdf-creation-station/

Code editor with lesscss support? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
Do you know a good code editor that supports the less syntax?
I tried Netbeans with the lesscss module and it sucks, no auto-complete, highlighting not accurate (and Netbeans doesn't even know CSS 3)...
It also needs to have good PHP, HTML and JS support:)
TextMate on MacOS, SublimeText on Linux/Windows.
Zeus is a programmer's editor for the Windows platform and its syntax highlighting is easily configurable. It should be possible to tweak it to support the less syntax?
I'm loving coding in Aptana IDE. It support up to date syntax like HTML5 tags (video, nav...) and CSS3 properties (border-radius, transform ...). It does not support Less naively but you can follow this(source) instruction to enable LESS too.
First step is to install LESS on Windows. If you already managed to install it head on over to Step 4!
Get Ruby for Windows from http://www.ruby-lang.org/ or -the easier- way: get the RubyInstaller for Windows from http://rubyinstaller.org/
Start Command Prompt with Ruby by clicking on Start --> Ruby 1.9xx --> Start Command Prompt with Ruby
Type in:
gem install less
If previous steps went fine you ready to use LESS. We just need to get Aptana to recognize our *.less fileformat. Let's go.
In Aptana, go to Window --> Preferences --> General --> Editors --> File Associations
Add a new file type named *.less
With the newly created *.less file type selected associate a editor below by clicking Add.. | Select "Aptana CSS Editor" (that one should be the one right at the top).
You're done!
Aptana is really up to date. So maybe they implemented the LESSCSS in the new build. Just check it out in their website.
Aptana Works with Mac and Windows and integrated with Git.
Espresso, Coda, Sublime and TextMate text all have plugins for less syntax highlighting on the mac.
CodeMirror has highlighting support for LESS (as well as JS, PHP, HTML). It's JavaScript (browser-based!), and has a way to add auto complete. Shouldn't be hard to add what you need if you've got the JS skills.
Brackets is a great open-source code editor from Adobe, that has built-in LESS support with autocomplete and syntax highlighting.

Modifying Qt core components/widgets, best practices? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I'm trying to enhance Qt's QPrintPreviewWidget by allowing it to display page numbers (in the footer somewhere). Unfortunately, I can't quite figure out how to go about it without hacking up Qt's source. I see a great spot for this additional code (in qpaintengine_preview.cpp, in newPage() method) but that means I'm going to have to recompile the whole of Qt (I got a binary build from Trolltech). Furthermore, if I decide to run an app that uses this functionality on someone else's box, I'm going to have to recompile there as well (say if it's a different arch).
Are there any other cleaner ways?
Thanks
Is the newPage() method virtual? If so, you could subclass and use that in you own applications, which would be a bit easier.
The second option would be to statically link your executable with the modified Qt libraries. You need to be aware of licensing concerns to do this. This way, every place you put the app will have your modified functionality. (You would still need to recompile for different architectures.)
Finally, you could get the latest sources from http://qt.gitorious.org/, modify them in the way you desire, and submit a patch back to the trolls. If you do this, you'll probably have to keep the old behavior the default, and add an option to enable the new behavior. They may or may not accept the patch. And if they do accept the patch, you may not be able to rely on other people's computers getting that version for quite some time, if ever.
Read the source code.
In this case, read QPrintPreviewDialog source code to see how it does it. This standard dialog has navigation buttons and a current page display, so it kind of does what you want (that is, if I really understood what you want to accomplish). The methods you're looking for are the following (src/gui/dialogs/qprintpreviewdialog.cpp):
void QPrintPreviewDialogPrivate::_q_previewChanged()
void QPrintPreviewDialogPrivate::_q_navigate(QAction* action)
void QPrintPreviewDialogPrivate::updateNavActions()
Basically, _q_previewChanged() is connected to QPrintPreviewWidget::previewChanged() signal. When it is emitted, the page number is updated with information acquired from QPrintPreviewWidget::currentPage() and QPrintPreviewWidget::pageCount().
As for extending the behavior of QPrintPreviewWidget you can try two approaches, both of them do not require a tailored version of Qt:
Extend QPrintPreviewWidget
In the constructor, access the layout() (it is a QVBoxLayout that is used interanally), add the footer widget, connect the previewChanged() signal to a slot that updates the page number and be done. The problem with this approach is that it counts on the layout to be present and be a QVBoxLayout. Since this is somehow private, it can break with newer versions.
Create a new class extending QWidget or QFrame
If you don't require your widget to be a QPrintPreviewWidget, just create a new QWidget derived class and add the print preview widget and the footer to a layout, connects slots etc. Use your derived widget instead of QPrintPreviewWidget.
Now, if you want to modify the behavior of the widget on already deployed binaries, things get uglier. I cannot help in this case.
If you have a library and this library has same symbols linker at runtime is looking for - to get the code for the print preview - then you can inject your own code to replace the real implementation. Method is called dll injection.
Check http://en.wikipedia.org/wiki/DLL_injection for more info

Resources