<commit_before>package gui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Graphics2D;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class Warpy {

	private JComboBox effects;
	private JButton saveImage;
	private ImagePanel feed;
	
	private Boolean isFeedLoaded = false;
	
	private BufferedImage currentFrame;
	
	private int feedWidth = 500;
	private int feedHeight = 500;

	public Warpy() {
	}

	public void InitGui() {
		JFrame window = new JFrame("Warpy");
		window.setLayout(new BorderLayout());
		window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		window.setResizable(false);

		JPanel toolbar = new JPanel();
		toolbar.setLayout(new FlowLayout());

		String[] effectsList = new String[] {"Blur", "Wobble", "Dog"};
		effects = new JComboBox<>(effectsList);

		saveImage = new JButton("Take Screenshot");
		saveImage.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				onTakeScreenshot();
			}
		});

		feed = new ImagePanel((currentFrame == null) ? getDefaultFeed() : currentFrame);
		feed.setPreferredSize(new Dimension(feedWidth, feedHeight));

		toolbar.add(effects);
		toolbar.add(saveImage);
		window.add(toolbar, BorderLayout.NORTH);
		window.add(feed, BorderLayout.CENTER);

		window.pack();
		window.setVisible(true);
	}

	private void onTakeScreenshot() {
		JDialog dialog = new JDialog();
		JLabel label = new JLabel( new ImageIcon() );
		dialog.add(label);
		dialog.pack();
		dialog.setVisible(true);
	}
	
	public void updateFeed(BufferedImage frame) {
		
	}
	
	private BufferedImage getDefaultFeed() {
		BufferedImage dflt = new BufferedImage(feedWidth, feedHeight, BufferedImage.TYPE_INT_RGB);
		Graphics2D g = dflt.createGraphics();
		g.setBackground(Color.GRAY);
		g.clearRect(0,0, feedWidth, feedHeight);
		currentFrame = dflt;
		return dflt;
	}

}<commit_msg>finished basic take screenshot dialog ui<commit_after>package gui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Graphics2D;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class Warpy {

	private JComboBox effects;
	private JButton saveImage;
	private ImagePanel feed;
	
	private Boolean isFeedLoaded = false;
	
	private BufferedImage currentFrame;
	
	private int feedWidth = 500;
	private int feedHeight = 500;

	public Warpy() {
	}

	public void InitGui() {
		JFrame window = new JFrame("Warpy");
		window.setLayout(new BorderLayout());
		window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		window.setResizable(false);

		JPanel toolbar = new JPanel();
		toolbar.setLayout(new FlowLayout());

		String[] effectsList = new String[] {"Blur", "Wobble", "Dog"};
		effects = new JComboBox<>(effectsList);

		saveImage = new JButton("Take Screenshot");
		saveImage.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				onTakeScreenshot();
			}
		});

		feed = new ImagePanel((currentFrame == null) ? getDefaultFeed() : currentFrame);
		feed.setPreferredSize(new Dimension(feedWidth, feedHeight));

		toolbar.add(effects);
		toolbar.add(saveImage);
		window.add(toolbar, BorderLayout.NORTH);
		window.add(feed, BorderLayout.CENTER);

		window.pack();
		window.setVisible(true);
	}

	private void onTakeScreenshot() {
		JDialog dialog = new JDialog();
		dialog.setUndecorated(false);
		
		JPanel masterLayout = new JPanel();
		masterLayout.setLayout(new BorderLayout());
		
		JPanel optionsLayout = new JPanel();
		optionsLayout.setLayout(new FlowLayout());
		
		JButton saveScreenshot = new JButton("Save");
		saveScreenshot.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				saveScreenshot();
			}
		});
		JButton dismiss = new JButton("Close");
		dismiss.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				dialog.dispose();
			}
		});
		optionsLayout.add(saveScreenshot);
		optionsLayout.add(dismiss);
		
		JLabel label = new JLabel( new ImageIcon() );
		
		
		masterLayout.add(optionsLayout, BorderLayout.NORTH);
		masterLayout.add(label, BorderLayout.CENTER);
		dialog.add(masterLayout);
		dialog.pack();
		dialog.setVisible(true);
	}
	
	public void updateFeed(BufferedImage frame) {
		currentFrame = frame;
	}
	
	private BufferedImage getDefaultFeed() {
		BufferedImage dflt = new BufferedImage(feedWidth, feedHeight, BufferedImage.TYPE_INT_RGB);
		Graphics2D g = dflt.createGraphics();
		g.setBackground(Color.GRAY);
		g.clearRect(0,0, feedWidth, feedHeight);
		currentFrame = dflt;
		return dflt;
	}
	
	private void saveScreenshot() {
		
	}

}
{'fraction_non_alphanumeric': 0.11564364056186262, 'fraction_numerical': 0.0038483740619588225, 'mean_word_length': 4.967853042479908, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7124525', 'n_tokens_mistral': 1847, 'n_tokens_neox': 1635, 'n_words': 363}