现在写在我的Django模板中我有类似10个文件的内容:
regular_player('Xi').
regular_player('Doyle').
expert_player('Houdini').
expert_player('Gandhi').
% don't allow expert players to be paired together
start --> good_pair.
good_pair --> (player, expert) ; (expert, player) ; (player, player).
player --> ['Xi'] ; ['Doyle'].
expert --> ['Houdini'] ; ['Gandhi'].
我想知道是否有办法:
package javafx_pressing_simultaneous_keys;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.paint.Color;
import javafx.scene.control.Label;
import javafx.scene.layout.BorderPane;
import javafx.scene.text.Font;
import javafx.stage.Stage;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.binding.BooleanBinding;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.EventHandler;
public class JavaFX_Pressing_Simultaneous_Keys extends Application
{
final BooleanProperty ZPressed = new SimpleBooleanProperty(false);
final BooleanProperty XPressed = new SimpleBooleanProperty(false);
final BooleanBinding ZAndXPressed = ZPressed.and(XPressed);
int i = 0;
@Override
public void start(Stage stage)
{
BorderPane bp = new BorderPane();
bp.setStyle("-fx-background-color: linear-gradient(from 25% 25% to 100% 100%, #DC143C, #661A33)");
Scene s = new Scene(bp, 340, 300);
Label l1 = new Label();
l1.setFont(new Font("Arial", 56));
l1.setTextFill(Color.CADETBLUE);
bp.setCenter(l1);
l1.setText(Integer.toString(i));
// How to Respond to both Keys ("Z" and "X") pressed together.
ZAndXPressed.addListener(new ChangeListener<Boolean>()
{
@Override
public void changed(ObservableValue<? extends Boolean> obs, Boolean werePressed, Boolean arePressed)
{
i++;
l1.setText(Integer.toString(i));
}
});
s.setOnKeyPressed(new EventHandler<KeyEvent>()
{
@Override
public void handle(KeyEvent ke)
{
if (ke.getCode() == KeyCode.Z)
ZPressed.set(true);
else
if (ke.getCode() == KeyCode.X)
XPressed.set(true);
}
});
s.setOnKeyReleased(new EventHandler<KeyEvent>()
{
@Override
public void handle(KeyEvent ke)
{
if (ke.getCode() == KeyCode.Z)
ZPressed.set(false);
else
if (ke.getCode() == KeyCode.X)
XPressed.set(false);
}
});
stage.setScene(s);
stage.setTitle("JavaFX (Pressing Simultaneous Keys)");
stage.setResizable(false);
stage.show();
}
public static void main(String[] args)
{
launch(args);
}
}
然后让python拥有它们的缩小版本。
答案 0 :(得分:2)
在链接模板中的脚本时,没有很好的方法可以合并。您可以编写一个脚本来为您生成URL,但除非该号码无法管理,否则我不建议这样做。 10并不是那么多。
对于缩小我会使用Django Compressor。它会将您链接的javascript自动转换为缩小的可缓存文件。