I am trying to display a video within a panel using racket/gui. It looks like the library to use is video. The video-player% class extends frame% which will not be contained inside a panel so I assume I have to use a video-player-server%. Is that correct?
It looks like the video-player-server% has a set-canvas method which seems like what I want, however if I provide it a canvas I get an error saying get-video-width is not defined on canvas. Is there a subclass of canvas I am missing?
This is what I have come up with so far.
#lang racket/gui
(require video/base video/player)
(define video (clip "toystory.mp4"))
(define video-server (new video-player-server%
(video video)))
(define (make-video parent)
(define panel (new panel%
(parent parent)))
(define canvas (new canvas%
(min-width 300)
(parent panel)))
; The problem appears to be with this line
(send video-server set-canvas canvas)
(displayln (send video-server get-fps))
panel)
(provide make-video)
It looks like there is a video-canvas% exposed by the video library
described here.
Related
My application is built from multiple plugins/model fragments. I am trying to contribute with a shared element (a part) in one of my fragments. I don't have access to the main e4xmi file (the one that contains the Trimmed Window) so it has to be done within my fragment. Any way I can do this ?
In your fragment.e4xmi just add a Model Fragment specifying the id of the parent Trimmed Window as the 'Extended Element ID' and 'sharedElements' as the 'Feature Name'. Add your part to the
Something like:
is there any possibility to resize an Zend_Pdf_Page Object from (e.g.) DIN-A4 to DIN-A6 (or any other size)?
i would like to merge 4 PDF (1 page) files to 1 pdf file (1 page). in each edge should be one of the 4 pdf files.
positioning, grid, e.g. is no problem... but how can i change the document size (of an existing pdf file) and how can i rotate the whole document?
i work with ZF1, but if the only way to fix this problem is to use an external library - no problem.
PS: sorry for my bad english (hope it is enough to understand my problem)
edit : 14:49 05/12/2014
also tried with imagick to convert pdf to image, but quality is too bad for printing as those small thumbs... :-(
Technically your requirements could be done by transforming the page into a so called form XObject which can be place on a new created page. That's how FPDI works: http://www.setasign.com/products/fpdi/demos/thumbnails/ (maybee an alternative for you).
I just checked the code of ZendPdf but I cannot find any method that may allow this.
Rotation can be done with FPDF/FPDI too: http://fpdf.org/en/script/script2.php
In your code, if you have something like $page = new Zend_Pdf_Page(); you can set here the desired dimensions.
For example, you can write $page = new Zend_Pdf_Page('297:420'); for A6 format (if I'm not mistaken).
To represent an A4 page in landscape (wide) orientation, you can write
$page = new Zend_Pdf_Page('a4-landscape');
or
$page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4_LANDSCAPE);
You can look at the documentation or the source code of the constructor of the Zend_Pdf_Page class for more information.
I hope it will help you. :)
I would like to add specific custom header in more general match (e.g. "^comp.") and add no such custom header in more specific match (e.g. "^comp.mail."). How to do it?
This seems to be a good case for Gnus Posting Styles.
(
("^comp."
("X-Custom-Header" "Custom Stuff"))
("^comp.more.specific"
("X-Custom-Header" nil)))
If the value is nil the header will be removed. See one of the paragraphs in the huge wall of text that I linked above.
I am currently learning template variables and trying to understand how they work and what they mean.
I've done a test on {$category->id_cms_category}, which I put in cms.tpl and I get a result 9, but when I put this in header.tpl or blockcms.tpl (left column), there is no results, it's blank.
Can somebody please explain how this works and how I can get the same result in different .tpl file?
I think the question is really how to assign $category class to for example header.tpl. Is it something to do with controllers?
Why can't I use certain variables everywhere? How does this work? I would be very happy if somebody explain this.
I am also still learning smarty.
Unfortunately you're hitting a common problem with smarty, and particularly how it's implemented within Prestashop.
Smarty variables are very much limited in scope within Prestashop and their scope is determined by which point the portion of code they are assigned in is run. In the case of {$category->id_cms_category} it is assigned within the CMSController at the point in which the main content (important stuff in the middle) is rendered, and so will be available within cms.tpl as you have demonstrated.
The reason it isn't available in the left column or in the header is due to the order in which each of these sections are rendered. This will be:
a) Header (top of page rather than the html header block specifically), then
b) Left Column, then
c) "Main" Content, then
d) Right Column, then
e) Footer
You should find that if you were to reference it in the right column or the footer of the page, then magically it will be available to you (on CMS pages only of course as we're relying on the CMSController being run and assigning it a value).
If you need to reference things like the cms category within the header of the page (maybe to set a highlight on horizontal navigation) then you're going to need to fetch the value and assign it to smarty yourself. You can do this in one of two ways:
1) Write a module which is hooked into the header and assign your variable there
2) Override the FrontController class and assign the smarty variable there (e.g. in the init function)
An example of 2) which you could try is to create a file /override/classes/FrontController.php containing:
<?php
class FrontController extends FrontControllerCore
{
function init() {
parent::init();
$id_cms_category = (int)Tools::getValue('id_cms_category');
$id_cms_page = (int)Tools::getValue('id_cms');
self::$smarty->assign(array(
'my_cms_category_id' => $id_cms_category,
'my_cms_page_id' => $id_cms_page
)
);
}
}
The above should allow you to display {my_cms_category_id} and {my_cms_page_id} anywhere in your theme (because we're setting the smarty variables before everything else is rendered). For a non-cms page they should both be 0, my_cms_category_id should be set non-zero on cms category pages, and {my_cms_page_id} should be non-zero when on a specific cms page.
Hope this goes some way to making it a little clearer!
Pardon my excruciatingly simple question, but I'm quite new to the world of Lift (and Scala, for that matter).
I'm following the "Getting Started" tutorial on the Lift website: http://liftweb.net/getting_started
I've got it up and running but I'd like to make a quick modification to the app so that every time I press enter in the textbox, it maintains focus. I've managed to get it to focus on page load using FocusOnLoad but I can't quite figure out how to get it to keep focus (using only Lift's classes, no custom JavaScript).
Here's what my def render method (the bind part) code looks like:
def render =
bind("chat", // the namespace for binding
"line" -> lines _, // bind the function lines
"input" -> FocusOnLoad(SHtml.text("", s => ChatServer ! s)) )
So that works for getting it to focus upon page load. But since this is a Comet app, the page only loads once.
All my other code looks exactly like the tutorial FWIW.
The render method in a CometActor only gets called when the CometActor is first initialized, which happens when the user first goes to the Chat page. Afterwards, the page updates usually happen inside of the lowPriority or highPriority methods. So if you want the text box to become focused after the user sends an AJAX update to the CometActor, you should add it to one of those methods. An example which uses JQuery would be this:
override def lowPriority = {
case m: List[ChatCmd] => {
val delta = m diff msgs
msgs = m
updateDeltas(delta)
partialUpdate((JqJE.Jq(JE.Str("input[type=text]")) ~> (new JsRaw("focus()") with JsMember)).toJsCmd)
}
}
I haven't tried compiling this, so it might need some slight tweaking. Essentially, it's just sending another JavaScript command to the browser that uses JQuery to find a text input on the page and then sets the focus on that control. If there are multiple text inputs, you'll need to modify the class on the HTML template for the control you want to set focus on, then make sure that you change your render method to be:
def render =
bind("chat",
"line" -> lines _,
"input" -%> FocusOnLoad(SHtml.text("", s => ChatServer ! s)) )
The -%> method instructs Lift to not ignore any attributes in the template during the bind phase. Then you can modify the JQuery selector to use that class to find the right control to focus on. Part of the form security in Lift obscures the ID assigned to forms and their controls to prevent XSS attacks, so it's generally better to use class selectors to find form controls using JQuery or some other Javascript framework.